lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
|
Map wrapper class providing improved performance on repeated element accumulation. More...
#include <accumulation_map.h>
Public Types | |
typedef Container | container_type |
Type of the container wrapped by this map. | |
typedef container_type::allocator_type | allocator_type |
Type of the allocator used by this map. | |
typedef container_type::size_type | size_type |
Type of the size returned by this map. | |
typedef container_type::difference_type | difference_type |
Type of the difference between the addresses of two elements in this map. | |
typedef container_type::pointer | pointer |
Type of pointers to the elements contained by this map. | |
typedef container_type::const_pointer | const_pointer |
Type of constant pointers to the elements contained by this map. | |
typedef container_type::reference | reference |
Type of references to the elements contained by this map. | |
typedef container_type::const_reference | const_reference |
Type of constant references to the elements contained by this map. | |
typedef container_type::value_type | value_type |
Type of the elements contained by this map. | |
typedef container_type::iterator | iterator |
Type of iterators to the elements contained by this map. | |
typedef container_type::const_iterator | const_iterator |
Type of constant iterators to the elements contained by this map. | |
typedef container_type::reverse_iterator | reverse_iterator |
Type of reverse iterators to the elements contained by this map. | |
typedef container_type::const_reverse_iterator | const_reverse_iterator |
Type of constant reverse iterators to the elements contained by this map. | |
typedef container_type::key_compare | key_compare |
Type of the function object used to compare the keys of two elements contained by this map. | |
typedef container_type::key_type | key_type |
Type of the keys used to compare two elements contained by this map. | |
typedef container_type::mapped_type | mapped_type |
Type of the values mapped to by this map. | |
typedef container_type::value_compare | value_compare |
Type of the function object used to compare two elements contained by this map. | |
Public Member Functions | |
accumulation_map () | |
Constructs an empty accumulation map. | |
accumulation_map (const key_compare &predicate) | |
Constructs an accumulation map containing the given key comparison predicate. | |
accumulation_map (const key_compare &predicate, const allocator_type &allocator) | |
Constructs an accumulation map containing the given key comparison predicate using the given allocator. | |
accumulation_map (const accumulation_map &right) | |
Copies elements from the given map to this map. | |
template<class Iterator > | |
accumulation_map (Iterator itFirst, Iterator itEnd) | |
Constructs an accumulation map from the given range of elements. | |
template<class Iterator > | |
accumulation_map (Iterator itFirst, Iterator itEnd, const key_compare &predicate) | |
Constructs an accumulation map from the given range of elements using the given key comparison predicate. | |
template<class Iterator > | |
accumulation_map (Iterator itFirst, Iterator itEnd, const key_compare &predicate, const allocator_type &allocator) | |
Constructs an accumulation map from the given range of elements using the given key comparison predicate and allocator. | |
accumulation_map & | operator= (const accumulation_map &right) |
Copies all elements from the given map to this map. | |
LEAN_INLINE void | inv_elem (const mapped_type &invalid) |
Sets a new invalid element marker value to be used. Leaves previously marked elements untouched, best used when container is empty! | |
LEAN_INLINE mapped_type | inv_elem (void) |
Gets a copy of the invalid element marker value currently in use. | |
LEAN_INLINE size_type | size (void) const |
Gets the number of elements contained by this map. | |
LEAN_INLINE bool | empty (void) const |
Checks if this map is empty. | |
LEAN_INLINE std::pair < iterator, bool > | insert (const value_type &element) |
Inserts the given element into this map. | |
LEAN_INLINE iterator | insert (iterator itWhere, const value_type &element) |
Inserts the given element into this map using the given positioning hint. | |
template<class Iterator > | |
LEAN_INLINE void | insert (Iterator itFirst, Iterator itEnd) |
Inserts the given range of elements into this map. | |
LEAN_INLINE size_type | erase (const key_type &key) |
Invalidates an element in this map by key. | |
LEAN_INLINE iterator | erase (iterator itWhere) |
Invalidates an element in this map by iterator. | |
LEAN_INLINE void | erase (iterator itFirst, iterator itEnd) |
Invalidates the given range of elements in this map. | |
LEAN_INLINE size_type | erase_fully (const key_type &key) |
Removes an element from this map by key. | |
LEAN_INLINE iterator | erase_fully (iterator itWhere) |
Removes an element from this map by iterator. | |
LEAN_INLINE void | erase_fully (iterator itFirst, iterator itEnd) |
Removes the given range of elements from this map. | |
LEAN_INLINE void | clear (void) |
Invalidates all elements in this map. | |
LEAN_INLINE void | reset (void) |
Removes all elements from this map. | |
LEAN_INLINE key_compare | key_comp (void) const |
Gets a comparison object that can be used to compare map keys. | |
LEAN_INLINE value_compare | value_comp (void) const |
Gets a comparison object that can be used to compare map values. | |
LEAN_INLINE allocator_type | get_allocator () const |
Gets a copy of the allocator used by this map. | |
LEAN_INLINE size_type | max_size (void) const |
Returns the maximum number of elements this map could hold. | |
LEAN_INLINE iterator | lower_bound (const key_type &key) |
Gets the first element whose key is greater than or equal to the given key. | |
LEAN_INLINE const_iterator | lower_bound (const key_type &key) const |
Gets the first element whose key is greater than or equal to the given key. | |
LEAN_INLINE iterator | upper_bound (const key_type &key) |
Gets the first element whose key is greater than the given key. | |
LEAN_INLINE const_iterator | upper_bound (const key_type &key) const |
Gets the first element whose key is greater than the given key. | |
LEAN_INLINE std::pair < iterator, iterator > | equal_range (const key_type &key) |
Gets the range of elements from lower_bound to upper_bound. | |
LEAN_INLINE std::pair < const_iterator, const_iterator > | equal_range (const key_type &key) const |
Gets the range of elements from lower_bound to upper_bound. | |
LEAN_INLINE iterator | find (const key_type &key) |
Gets an element by key. | |
LEAN_INLINE const_iterator | find (const key_type &key) const |
Gets an element by key. | |
LEAN_INLINE size_type | count (const key_type &key) const |
Gets the number of elements matching the given key. | |
LEAN_INLINE mapped_type & | operator[] (const key_type &key) |
Gets an element by key, inserting one if none existent so far. | |
LEAN_INLINE iterator | begin (void) |
Returns an iterator to the first element contained by this map. | |
LEAN_INLINE const_iterator | begin (void) const |
Returns a constant iterator to the first element contained by this map. | |
LEAN_INLINE iterator | end (void) |
Returns an iterator beyond the last element contained by this map. | |
LEAN_INLINE const_iterator | end (void) const |
Returns a constant iterator beyond the last element contained by this map. | |
LEAN_INLINE reverse_iterator | rbegin (void) |
Returns a reverse iterator to the last element contained by this map. | |
LEAN_INLINE const_reverse_iterator | rbegin (void) const |
Returns a constant reverse iterator to the last element contained by this map. | |
LEAN_INLINE reverse_iterator | rend (void) |
Returns a reverse iterator beyond the first element contained by this map. | |
LEAN_INLINE const_reverse_iterator | rend (void) const |
Returns a constant reverse iterator beyond the first element contained by this map. | |
LEAN_INLINE void | swap (accumulation_map &right) |
Map wrapper class providing improved performance on repeated element accumulation.
This class stores elements of the given type without destructing them on remove or clear, thus eliminating the overhead incurred by destruction and re-construction of frequently removed elements.