#include <Array_Map.h>
Public Types | |
typedef Key | key_type |
typedef Value | data_type |
typedef std::pair< key_type, data_type > | value_type |
typedef value_type * | iterator |
typedef value_type const * | const_iterator |
typedef value_type & | reference |
typedef value_type const & | const_reference |
typedef value_type * | pointer |
typedef value_type const * | const_pointer |
typedef ptrdiff_t | difference_type |
typedef size_t | size_type |
typedef std::reverse_iterator< iterator > | reverse_iterator |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
Public Member Functions | |
ACE_Array_Map (size_type s=0) | |
Default Constructor. | |
template<typename InputIterator> | |
ACE_Array_Map (InputIterator f, InputIterator l) | |
ACE_Array_Map (ACE_Array_Map const &map) | |
ACE_Array_Map & | operator= (ACE_Array_Map const &map) |
~ACE_Array_Map (void) | |
Destructor. | |
size_type | size (void) const |
Return current size of map. | |
size_type | max_size (void) const |
Maximum number of elements the map can hold. | |
bool | empty (void) const |
Is the map empty? | |
void | swap (ACE_Array_Map &map) |
std::pair< iterator, bool > | insert (value_type const &x) |
Insert the value x into the map. | |
template<typename InputIterator> | |
void | insert (InputIterator f, InputIterator l) |
Insert range of elements into map. | |
void | erase (iterator pos) |
Remove element at position pos from the map. | |
size_type | erase (key_type const &k) |
Remove element corresponding to key k from the map. | |
void | erase (iterator first, iterator last) |
Remove range of elements [first, last) from the map. | |
void | clear (void) |
Clear contents of map. | |
size_type | count (key_type const &k) |
Count the number of elements corresponding to key k. | |
data_type & | operator[] (key_type const &k) |
Convenience array index operator. | |
Forward Iterator Accessors | |
Forward iterator accessors. | |
iterator | begin (void) |
iterator | end (void) |
const_iterator | begin (void) const |
const_iterator | end (void) const |
Reverse Iterator Accessors | |
Reverse iterator accessors. | |
reverse_iterator | rbegin (void) |
reverse_iterator | rend (void) |
const_reverse_iterator | rbegin (void) const |
const_reverse_iterator | rend (void) const |
Search Operations | |
Search the map for data corresponding to key k. | |
iterator | find (key_type const &k) |
const_iterator | find (key_type const &k) const |
Private Member Functions | |
void | grow (size_type s) |
Increase size of underlying buffer by s. | |
Private Attributes | |
size_type | size_ |
Number of elements in the map. | |
size_type | capacity_ |
Current size of underlying array. | |
value_type * | nodes_ |
Underlying array containing keys and data. |
Map implementation that focuses on small footprint and fast iteration. Search times are, however, linear (O(n)) meaning that this map isn't suitable for large data sets that will be searched in performance critical areas of code. Iteration over large data sets, however, is faster than linked list-based maps, for example, since spatial locality is maximized through the use of contiguous arrays as the underlying storage.
ACE_Array_Map
is a unique associative container, meaning that duplicate values may not be added to the map. It is also pair associative (value_type is a std::pair<>). It is not a sorted container. std::map
-like interface is exposed by this class portability. Furthermore, this map's iterators are compatible with STL algorithms.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Default Constructor. Create an empty map with a preallocated buffer of size s. |
|
|
|
|
|
Destructor.
|
|
|
|
|
|
Clear contents of map.
|
|
Count the number of elements corresponding to key k.
|
|
Is the map empty?
|
|
|
|
|
|
Remove range of elements [first, last) from the map.
|
|
Remove element corresponding to key k from the map.
|
|
Remove element at position pos from the map.
|
|
|
|
|
|
Increase size of underlying buffer by s.
|
|
Insert range of elements into map.
|
|
Insert the value x into the map. STL-style map insertion method.
|
|
Maximum number of elements the map can hold.
|
|
|
|
Convenience array index operator. Array index operator that allows insertion and retrieval of elements using an array index syntax, such as:
|
|
|
|
|
|
|
|
|
|
Return current size of map.
|
|
Swap the contents of this map with the given map in an exception-safe manner. |
|
Current size of underlying array.
|
|
Underlying array containing keys and data.
|
|
Number of elements in the map.
|