![]() |
Home | Libraries | People | FAQ | More |
map is an Associative
Sequence of heteregenous typed data elements. Each element is a
key/data pair (see fusion::pair
)
where the key has no data (type only). Type identity is used to impose
an equivalence relation on keys. A map may contain at most one element
for each key. Membership testing and element key lookup has constant runtime
complexity (see Overloaded
Functions).
#include <boost/fusion/sequence/container/map.hpp>
template < typename T0 = unspecified , typename T1 = unspecified , typename T2 = unspecified ... , typename TN = unspecified > struct map;
The variadic class interface accepts 0
to FUSION_MAX_MAP_SIZE
elements, where FUSION_MAX_MAP_SIZE
is a user definable predefined maximum that defaults to 10
.
Example:
map<pair
<int, char>,pair
<char, char>,pair
<double, char> >
You may define the preprocessor constant FUSION_MAX_MAP_SIZE
before including any Fusion header to change the default. Example:
#define FUSION_MAX_MAP_SIZE 20
Parameter | Description | Default |
---|---|---|
T0 ...TN
|
Element types | unspecified-type |
Notation
M
map
type
m
map
e0
...en
fusion::pair
)
s
Semantics of an expression is defined only where it differs from, or is not defined in Random Access Sequence and Associative Sequence.
Expression | Semantics |
---|---|
M() |
Creates a map with default constructed elements. |
M(e0, e1,...
en) |
Creates
a map with element pairs e0 ...en . |
M(s) |
Copy
constructs a map from a Forward
Sequence s . |
m =
s |
Assigns
to a map, m , from
a Forward
Sequence s . |
typedef map<pair
<int, char> ,pair
<double, std::string> > map_type; map_type m(make_pair
<int>('X') ,make_pair
<double>("Men")); std::cout <<at
<int>(m) << std::endl; std::cout <<at
<double>(m) << std::endl;
Copyright © 2001-2005 Joel de Guzman, Dan Marsden |