...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
An Associative Sequence allows efficient retrieval of elements based on keys. Like associative sequences in MPL, and unlike associative containers in STL, Fusion associative sequences have no implied ordering relation. Instead, type identity is used to impose an equivalence relation on keys, and the order in which sequence elements are traversed during iteration is left unspecified. In addition, unlike STL, Associative Sequences have mutable iterators. This is due to the fact that there is no associated ordering relation and the runtime value of the keys themselves do not have any effect on the associativity of the sequence.
Notation
An Associative Sequence
An Associative Sequence type
An arbitrary key type
An arbitrary object
A Sequence element
For any Associative Sequence the following expressions must be valid:
Expression |
Return type |
Type Requirements |
Runtime Complexity |
---|---|---|---|
has_key<K>(s) |
MPL Boolean Constant. Convertible to bool. |
|
Constant |
at_key<K>(s) |
Any type |
|
Constant |
at_key<K>(s) = o |
Any type |
s is mutable and e = o, where e is the first element in the sequence, is a valid expression. |
Constant |
Expression |
Compile Time Complexity |
---|---|
result_of::has_key<S, K>::type |
Amortized constant time |
result_of::at_key<S, K>::type |
Amortized constant time |
result_of::value_at_key<S, K>::type |
Amortized constant time |
Expression |
Semantics |
---|---|
has_key<K>(s) |
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 has_key. |
at_key<K>(s) |
The element associated with the key K in the sequence s; see at. |