Back to Arangodb

map

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/map.html

3.12.9.15.6 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Sequences / Classes / map |

map

Description

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 formHeader
Variadic#include <boost/mpl/map.hpp>
Numbered#include <boost/mpl/map/map_n_.hpp>

Model of

Expression semantics

In the following table and subsequent specifications, m is an instance of map, pos is an iterator into m, x and _p_1,_p_2,... _p_n are pairs, and k is an arbitrary type.

ExpressionSemantics
[map](./map.html)<_p_1,_p_2,..._p_n>[map](./map.html)_n_<_p_1,_p_2,..._p_n>

| map of elements _p_1,_p_2,... _p_n; see Variadic Sequence. | |

[map](./map.html)<_p_1,_p_2,..._p_n>::type[map](./map.html)_n_<_p_1,_p_2,..._p_n>::type

| Identical to mapn<_p_1,_p_2,... _p_n>; see Variadic Sequence. | | begin<m>::type | An iterator pointing to the beginning of m; see Associative Sequence. | | end<m>::type | An iterator pointing to the end of m; see Associative Sequence. | | size<m>::type | The size of m; see Associative Sequence. | | empty<m>::type | A boolean Integral Constant c such that c::value == true if and only if m is empty; see Associative Sequence. | | front<m>::type | The first element in m; see Associative Sequence. | | has_key<m,k>::type | Queries the presence of elements with the key k in m; see Associative Sequence. | | count<m,k>::type | The number of elements with the key k in m; see Associative Sequence. | | order<m,k>::type | A unique unsigned Integral Constant associated with the key k in m; see Associative Sequence. | |

[at](./at.html)<m,k>::type[at](./at.html)<m,k,default>::type

| The element associated with the key k in m; see Associative Sequence. | | key_type<m,x>::type | Identical to x::first; see Associative Sequence. | | value_type<m,x>::type | Identical to x::second; see Associative Sequence. | | insert<m,x>::type |

A new map, t, equivalent to m except that

[at](./at.html)< t,[key\_type](./key-type.html)<m,x>::type >::type

is identical to value_type<m,x>::type.

| | insert<m,pos,x>::type | Equivalent to insert<m,x>::type; pos is ignored. | | erase_key<m,k>::type | A new map, t, equivalent to m except that has_key<t, k>::value == false. | | erase<m,pos>::type | Equivalent to erase<m, deref<pos>::type >::type. | | clear<m>::type | An empty map; see clear. |

Example

typedef[map](./map.html)<[pair](./pair.html)<int,unsigned>
    ,[pair](./pair.html)<char,unsigned char>
    ,[pair](./pair.html)<[long\_](./long.html)<5>,char[17]>
    ,[pair](./pair.html)<int[42],bool>
    > m;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([size](./size.html)<m>::value, ==, 4 );[BOOST\_MPL\_ASSERT\_NOT](./assert-not.html)(([empty](./empty.html)<m> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<m,int>::type, unsigned > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<m,[long\_](./long.html)<5> >::type, char[17] > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<m,int[42]>::type, bool > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<m,long>::type,[void\_](./void.html)> ));

See also

Sequences, Variadic Sequence, Associative Sequence, Extensible Associative Sequence, set, vector

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |