Ordered associative container mapping unique keys to values.
Declared in <bslstl_map.h>
template<
class KEY,
class VALUE,
class COMPARATOR = std::less<KEY>,
class ALLOCATOR = allocator<pair<KEY const, VALUE>>>
class map;
This class template implements a value-semantic container type holding an ordered sequence of key-value pairs having unique keys that provide a mapping from keys (of the template parameter type, KEY) to their associated values (of another template parameter type, VALUE).
This class: * supports a complete set of value-semantic operations
except for BDEX serialization * is exception-neutral * is alias-safe * is const thread-safe For terminology see {bsldoc_glossary}.
| Name | Description |
|---|---|
value_compare | Adaptor that compares value_type objects by their keys. |
| Name | Description |
|---|---|
allocator_type | Alias for the allocator type ALLOCATOR. |
const_iterator | Constant bidirectional iterator over map elements. |
const_pointer | Alias for the const pointer type supplied by the allocator traits. |
const_reference | Alias for a constant reference to a map element. |
const_reverse_iterator | Reverse iterator type for traversing the map in reverse order. |
difference_type | Signed integer type measuring iterator distance. |
iterator | Bidirectional iterator over map elements. |
key_compare | Alias for the key-comparison functor type COMPARATOR. |
key_type | Alias for the key type KEY. |
mapped_type | Alias for the mapped value type VALUE. |
pointer | Alias for the pointer type supplied by the allocator traits. |
reference | Alias for a modifiable reference to a map element. |
reverse_iterator | Reverse iterator over map elements. |
size_type | Alias for the size type supplied by the allocator traits. |
value_type | Alias for the map element type pair<const KEY, VALUE>. |
| Name | Description |
|---|---|
map [constructor] | Constructors |
~map [destructor] | Destroy this object. |
operator= | Assignment operators |
at | at overloads |
begin | begin overloads |
cbegin | Return a const iterator to the first element, or cend if empty. |
cend | Return an iterator providing non-modifiable access to the past-the-end element in the ordered sequence of value_type objects maintained by this map. |
clear | Remove all entries from this map. Note that the map is empty after this call, but allocated memory may be retained for future use. |
contains | Return whether this map contains an element equivalent to key. |
count | Return the number of elements equivalent to key. |
crbegin | Return a const reverse iterator to the last element, or crend if empty. |
crend | Return a const reverse iterator to prior-to-beginning. |
emplace | Emplace a newly constructed element into this map. |
emplace_hint | Emplace a newly constructed element near hint. |
empty | Return true if this map contains no elements, and false otherwise. |
end | end overloads |
equal_range | Return the half-open range of elements equivalent to key. |
erase | erase overloads |
find | find overloads |
get_allocator | Return (a copy of) the allocator used for memory allocation by this map. |
insert | insert overloads |
insert_or_assign | insert_or_assign overloads |
insert_range | Insert elements from range whose keys are not already present. |
key_comp | Return the key-comparison functor used by this map. |
lower_bound | lower_bound overloads |
max_size | Return a theoretical upper bound on the size of this map. |
operator[] | Subscript operators |
rbegin | rbegin overloads |
rend | rend overloads |
size | Return the number of elements in this map. |
swap | Exchange the value and comparator with other. |
try_emplace | try_emplace overloads |
upper_bound | upper_bound overloads |
value_comp | Return a functor that compares two value_type objects by key. |
| Name | Description |
|---|---|
map<KEY, VALUE> | Deduce KEY and VALUE from an initializer-list constructor argument. |
map<KEY, VALUE> | Deduce KEY and VALUE from iterator-pair construction with a pointer allocator. |
map<KEY, VALUE, COMPARATOR> | Deduce KEY, VALUE, and COMPARATOR from initializer-list construction. |
map<KEY, VALUE, COMPARATOR> | Deduce KEY, VALUE, and COMPARATOR from iterator-pair construction. |
map<KEY, VALUE, COMPARATOR, ALLOCATOR> | Deduce KEY, VALUE, COMPARATOR, and ALLOCATOR from initializer-list construction. |
map<KEY, VALUE, COMPARATOR, ALLOCATOR> | Deduce KEY, VALUE, COMPARATOR, and ALLOCATOR from iterator-pair construction. |
map<KEY, VALUE, std::less<KEY>, ALLOCATOR> | Deduce KEY, VALUE, and ALLOCATOR from initializer-list construction. |
map<KEY, VALUE, std::less<KEY>, ALLOCATOR> | Deduce KEY, VALUE, and ALLOCATOR from iterator-pair construction. |
| Name | Description |
|---|---|
erase_if | Erase every element of m that satisfies predicate. |
operator<=> | Perform a lexicographic three-way comparison of lhs and rhs. |
operator== | Return true if lhs and rhs have the same value. |
swap | Exchange the value and comparator of a with those of b. |