4
4
CLAW is a free library without any particular aim but being useful to
7
Copyright (C) 2005-2008 Julien Jorge
7
Copyright (C) 2005-2010 Julien Jorge
9
9
This library is free software; you can redistribute it and/or
10
10
modify it under the terms of the GNU Lesser General Public
26
26
* \file max_vector.hpp
27
* \brief Stockage d'une liste d'�l�ments ayant la m�me valeur avec majoration.
27
* \brief Fill a container with some values, keeping only all the "maximum"
28
29
* \author Julien Jorge
30
31
#ifndef __CLAW_MAX_VECTOR_HPP__
31
32
#define __CLAW_MAX_VECTOR_HPP__
38
* \brief Stockage d'une liste d'�l�ments ayant la m�me valeur avec
40
* L'ajout d'un �l�ment de valeur sup�rieur � la valeur max actuelle supprime
41
* tous les �l�ments pr�sents de la liste.
42
* \param E : type des �l�ments � stocker.
40
* \brief Fill a container with some values, keeping only all the "maximum"
43
* Adding a value greater than the previous ones remove all the old values.
45
* \b Template \b parameters:
46
* - \param E: the type of the stored values.
47
* - \param Comp: how to compare the old values with the new ones.
48
* - \param Container: the type of the container in which the values are
43
51
* \author Julien Jorge
45
template < class E > class max_vector
53
template< typename E, typename Comp = std::less<E>,
54
typename Container = std::vector<E> >
49
explicit max_vector(const E& e);
51
const std::vector<E>& get_v() const;
58
/** \brief The type of the values stored in the container. */
61
/** \brief The comparator used to compare the values inserted. */
62
typedef Comp comparator_type;
64
/** \brief The type of the container in which the values are stored. */
65
typedef Container container_type;
69
explicit max_vector(const value_type& e);
71
void add(const value_type& e);
72
const container_type& get_v() const;
54
/** \brief Maximum des �l�ment du vecteur. */
75
/** \brief The maximum values. */
76
container_type m_values;
57
/** \brief Les maximums rencontr�s. */
58
std::vector<E> m_vector;
61
80
} // namespace claw