3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/set.html
| Prev Next | Back Along | Up Home | Full TOC | Front Page / Sequences / Classes / set |
set is a variadic, associative, extensible sequence of types that supports constant-time insertion and removal of elements, and testing for membership. A set may contain at most one element for each key.
| Sequence form | Header |
|---|---|
| Variadic | #include <boost/mpl/set.hpp> |
| Numbered | #include <boost/mpl/set/set_n_.hpp> |
In the following table, s is an instance of set, pos is an iterator into s, and x, k, and _t_1,_t_2,... _t_n is a set of unique arbitrary types. [Note: See below for an example of how to construct a set from a list of potentially non-unique types — end note]
| Expression | Semantics |
|---|---|
[set](./set.html)<_t_1,_t_2,..._t_n>[set](./set.html)_n_<_t_1,_t_2,..._t_n>
| set of elements _t_1,_t_2,... _t_n; see Variadic Sequence. | |
[set](./set.html)<_t_1,_t_2,..._t_n>::type[set](./set.html)_n_<_t_1,_t_2,..._t_n>::type
| Identical to setn<_t_1,_t_2,... _t_n>; see Variadic Sequence. | | begin<s>::type | An iterator pointing to the beginning of s; see Associative Sequence. | | end<s>::type | An iterator pointing to the end of s; see Associative Sequence. | | size<s>::type | The size of s; see Associative Sequence. | | empty<s>::type | A boolean Integral Constant c such that c::value == true if and only if s is empty; see Associative Sequence. | | front<s>::type | The first element in s; see Associative Sequence. | | has_key<s,k>::type | A boolean Integral Constant c such that c::value == true if and only if there is one or more elements with the key k in s; see Associative Sequence. | | count<s,k>::type | The number of elements with the key k in s; see Associative Sequence. | | order<s,k>::type | A unique unsigned Integral Constant associated with the key k in s; see Associative Sequence. | |
[at](./at.html)<s,k>::type[at](./at.html)<s,k,def>::type
| The element associated with the key k in s; see Associative Sequence. | | key_type<s,x>::type | Identical to x; see Associative Sequence. | | value_type<s,x>::type | Identical to x; see Associative Sequence. | | insert<s,x>::type |
A new set equivalent to s except that
[at](./at.html)< t,[key\_type](./key-type.html)<s,x>::type >::type
is identical to value_type<s,x>::type.
| | insert<s,pos,x>::type | Equivalent to insert<s,x>::type; pos is ignored. | | erase_key<s,k>::type | A new set equivalent to s except that has_key<t, k>::value == false. | | erase<s,pos>::type | Equivalent to erase<s, deref<pos>::type >::type. | | clear<s>::type | An empty set; see clear. |
Basic set invariants:
typedef[set](./set.html)< int,long,double,[int\_](./int.html)<5> > s;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([size](./size.html)<s>::value, ==, 4 );[BOOST\_MPL\_ASSERT\_NOT](./assert-not.html)(([empty](./empty.html)<s> ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<s,int>::type, int > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<s,long>::type, long > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<s,[int\_](./int.html)<5> >::type,[int\_](./int.html)<5> > ));[BOOST\_MPL\_ASSERT](./assert.html)(( is_same<[at](./at.html)<s,char>::type,[void\_](./void.html)> ));
Constructing a set from a list of potentially non-unique types:
typedef[fold](./fold.html)<[vector](./vector.html)<int,int,long,long>
, set0<>
,[insert](./insert.html)<[\_1](./placeholders.html),[\_2](./placeholders.html)>
>::type s;[BOOST\_MPL\_ASSERT\_RELATION](./assert-relation.html)([size](./size.html)<s>::value, ==, 2 );
Sequences, Variadic Sequence, Associative Sequence, Extensible Associative Sequence, set_c, map, vector
| Prev Next | Back Along | Up Home | Full TOC |
Copyright © 2001-2011 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) |