Home | Libraries | People | FAQ | More |
boost::itl::map — Addable, subractable and intersectable maps.
template<typename DomainT , typename CodomainT , class Traits = itl::partial_absorber, ITL_COMPARE Compare = ITL_COMPARE_INSTANCE(std::less, DomainT), ITL_COMBINE Combine = ITL_COMBINE_INSTANCE(itl::inplace_plus, CodomainT), ITL_SECTION Section = ITL_SECTION_INSTANCE(itl::inplace_et, CodomainT), ITL_ALLOC Alloc = std::allocator> class map { public: // types typedef Alloc< typename std::pair< const DomainT, CodomainT > > allocator_type; typedef itl::map< DomainT, CodomainT, Traits, Compare, Combine, Section, Alloc > type; typedef ITL_IMPL_SPACE::map< DomainT, CodomainT, ITL_COMPARE_DOMAIN(Compare, DomainT), allocator_type > base_type; typedef itl::set< DomainT, Compare, Alloc > set_type; typedef Traits traits; typedef DomainT domain_type; typedef DomainT key_type; typedef CodomainT codomain_type; typedef CodomainT mapped_type; typedef CodomainT data_type; typedef std::pair< const DomainT, CodomainT > element_type; typedef std::pair< const DomainT, CodomainT > value_type; typedef domain_compare key_compare; typedef inverse< codomain_combine >::type inverse_codomain_combine; typedef inverse< codomain_intersect >::type inverse_codomain_intersect; typedef base_type::value_compare value_compare; typedef base_type::pointer pointer; typedef base_type::const_pointer const_pointer; typedef base_type::reference reference; typedef base_type::const_reference const_reference; typedef base_type::iterator iterator; typedef base_type::const_iterator const_iterator; typedef base_type::size_type size_type; typedef base_type::difference_type difference_type; typedef base_type::reverse_iterator reverse_iterator; typedef base_type::const_reverse_iterator const_reverse_iterator; // construct/copy/destruct map(); map(const key_compare &); template<class InputIterator > map(InputIterator, InputIterator); template<class InputIterator > map(InputIterator, InputIterator, const key_compare &); map(const map &); map(const element_type &); map& operator=(const map &); // public member functions typedef ITL_COMPARE_DOMAIN(Compare, DomainT) ; typedef ITL_COMBINE_CODOMAIN(Combine, CodomainT) ; typedef ITL_SECTION_CODOMAIN(Section, CodomainT) ; void swap(map &) ; bool contains(const domain_type &) const; bool contains(const element_type &) const; bool contained_in(const map &) const; bool contains(const map &) const; size_t iterative_size() const; size_t cardinality() const; codomain_type operator()(const domain_type &) const; map & add(const value_type &) ; iterator add(iterator, const value_type &) ; map & subtract(const value_type &) ; std::pair< iterator, bool > insert(const value_type &) ; iterator insert(iterator, const value_type &) ; map & set(const element_type &) ; size_type erase(const element_type &) ; void add_intersection(map &, const domain_type &) const; void add_intersection(map &, const element_type &) const; void add_intersection(map &, const set_type &) const; void add_intersection(map &, const map &) const; bool intersects(const domain_type &) const; bool intersects(const element_type &) const; map & flip(const element_type &) ; void absorb_neutrons() ; std::string as_string() const; template<class Predicate > map & erase_if(const Predicate &) ; template<class Predicate > map & assign_if(const map &, const Predicate &) ; void domain(set_type &) const; // public static functions template<typename IteratorT > static const key_type & key_value(IteratorT) ; template<typename IteratorT > static const data_type & data_value(IteratorT) ; template<typename IteratorT > static const codomain_type & codomain_value(IteratorT) ; template<typename LeftIterT , typename RightIterT > static bool key_less(LeftIterT, RightIterT) ; static value_type make_element(const key_type &, const data_type &) ; // private member functions template<class Combiner > map & _add(const value_type &) ; template<class Combiner > iterator _add(iterator, const value_type &) ; template<class Combiner > map & _subtract(const value_type &) ; };
map
public
construct/copy/destructmap();
map(const key_compare & comp);
template<class InputIterator > map(InputIterator first, InputIterator past);
template<class InputIterator > map(InputIterator first, InputIterator past, const key_compare & comp);
map(const map & src);
map(const element_type & key_value_pair);
map& operator=(const map & src);
map
public member functionstypedef ITL_COMPARE_DOMAIN(Compare, DomainT) ;
typedef ITL_COMBINE_CODOMAIN(Combine, CodomainT) ;
typedef ITL_SECTION_CODOMAIN(Section, CodomainT) ;
void swap(map & src) ;
bool contains(const domain_type & key) const;
Checks if a key is in the map
bool contains(const element_type & key_value_pair) const;
Checks if a key-value pair is in the map
bool contained_in(const map & super) const;
Is *this
contained in super
?
bool contains(const map & sub) const;
Does *this
contain sub
?
size_t iterative_size() const;
iterative_size()
yields the number of elements that is visited throu complete iteration. For interval sets iterative_size()
is different from size()
.
size_t cardinality() const;
codomain_type operator()(const domain_type & key) const;
Total select function.
map & add(const value_type & value_pair) ;
add
inserts value_pair
into the map if it's key does not exist in the map. If value_pairs's
key value exists in the map, it's data value is added to the data value already found in the map.
iterator add(iterator prior, const value_type & value_pair) ;
add
add value_pair
into the map using prior
as a hint to insert value_pair
after the position prior
is pointing to.
map & subtract(const value_type & value_pair) ;
If the value_pair's
key value is in the map, it's data value is subtraced from the data value stored in the map.
std::pair< iterator, bool > insert(const value_type & value_pair) ;
iterator insert(iterator prior, const value_type & value_pair) ;
map & set(const element_type & key_value_pair) ;
With key_value_pair = (k,v)
set value v
for key k
size_type erase(const element_type & key_value_pair) ;
erase key_value_pair
from the map. Erase only if, the exact value content val
is stored for the given key.
void add_intersection(map & section, const domain_type & key_value) const;
The intersection of key
in *this
map is added to section
.
void add_intersection(map & section, const element_type & key_value_pair) const;
The intersection of key_value_pair
and *this
map is added to section
.
void add_intersection(map & section, const set_type & sectant) const;
The intersection of set sectant
with *this
map is added to section
.
void add_intersection(map & section, const map & sectant) const;
The intersection of map sectant
with *this
map is added to section
.
bool intersects(const domain_type & key) const;
Returns true, if there is an intersection of key
and *this
map. Functions intersects
and contains
are identical on key value arguments of type domain_type
. Complexity: Logarithmic in container size.
bool intersects(const element_type & key_value_pair) const;
Returns true, if there is an intersection of and *this
map. If the key is found, the content of key_value_pair
has to have an intersection with the content of the data value in the map. Complexity: Logarithmic in container size.
map & flip(const element_type & key_value_pair) ;
void absorb_neutrons() ;
std::string as_string() const;
Represent this map as string
template<class Predicate > map & erase_if(const Predicate &) ;
Erase the elements in *this map to which property hasProperty
applies. Keep all the rest.
template<class Predicate > map & assign_if(const map & src, const Predicate &) ;
Copy the elements in map src
to which property hasProperty
applies into *this
map.
void domain(set_type & domain_set) const;
Copy the key values of the map to domain_set
. Complexity: Linear.
map
public static functionstemplate<typename IteratorT > static const key_type & key_value(IteratorT value_) ;
key_value
allows for a uniform access to key_values
which is is used for common algorithms on sets and maps.
template<typename IteratorT > static const data_type & data_value(IteratorT value_) ;
data_value
allows for a uniform access to data_values
which is is used for common algorithms on sets and maps.
template<typename IteratorT > static const codomain_type & codomain_value(IteratorT value_) ;
codomain_value
allows for a uniform access to codomain_values
which is is used for common algorithms on sets and maps.
template<typename LeftIterT , typename RightIterT > static bool key_less(LeftIterT lhs_, RightIterT rhs_) ;
key_less
allows for a uniform notation of key comparison which is used for common algorithms on sets and maps.
static value_type make_element(const key_type & key_val, const data_type & data_val) ;
iterative_size()
yields the number of elements that is visited throu complete iteration. For interval sets iterative_size()
is different from size()
.