...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Sequences / Classes / map |
map is a variadic, associative, extensible sequence of type pairs that supports constant-time insertion and removal of elements, and testing for membership. A map may contain at most one element for each key.
Sequence form | Header |
---|---|
Variadic | #include <boost/mpl/map.hpp> |
Numbered | #include |
In the following table and subsequent specifications, m is an instance of map, pos is an iterator into m, x and p1,p2,... pn are pairs, and k is an arbitrary type.
Expression | Semantics |
---|---|
map<p1,p2,... pn> mapn<p1,p2,... pn> |
map of elements p1,p2,... pn; see Variadic Sequence. |
map<p1,p2,... pn>::type mapn<p1,p2,... pn>::type |
Identical to mapn<p1,p2,... pn>; see Variadic Sequence. |
begin |
An iterator pointing to the beginning of m; see Associative Sequence. |
end |
An iterator pointing to the end of m; see Associative Sequence. |
size |
The size of m; see Associative Sequence. |
empty |
A boolean Integral Constant c such that c::value == true if and only if m is empty; see Associative Sequence. |
front |
The first element in m; see Associative Sequence. |
has_key |
Queries the presence of elements with the key k in m; see Associative Sequence. |
count |
The number of elements with the key k in m; see Associative Sequence. |
order |
A unique unsigned Integral Constant associated with the key k in m; see Associative Sequence. |
at |
The element associated with the key k in m; see Associative Sequence. |
key_type |
Identical to x::first; see Associative Sequence. |
value_type |
Identical to x::second; see Associative Sequence. |
insert |
A new map, t, equivalent to m except that at< t, key_type is identical to value_type |
insert |
Equivalent to insert |
erase_key |
A new map, t, equivalent to m except that
has_key |
erase |
Equivalent to erase |
clear |
An empty map; see clear. |
typedef map< pair, pair , pair<long_<5>,char[17]> , pair > m; BOOST_MPL_ASSERT_RELATION( size ::value, ==, 4 ); BOOST_MPL_ASSERT_NOT(( empty )); BOOST_MPL_ASSERT(( is_same< at ::type, unsigned > )); BOOST_MPL_ASSERT(( is_same< at long_<5> >::type, char[17] > )); BOOST_MPL_ASSERT(( is_same< at ::type, bool > )); BOOST_MPL_ASSERT(( is_same< at ::type, void_ > ));