Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Associative Sequence

Description

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. Keys are not checked for uniqueness.

Notation

s

An Associative Sequence

S

An Associative Sequence type

K

An arbitrary key type

o

An arbitrary object

e

A Sequence element

Valid Expressions

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

Result Type Expressions

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

[Note] Note

result_of::at_key<S, K> returns the actual type returned by at_key<K>(s). In most cases, this is a reference. Hence, there is no way to know the exact element type using result_of::at_key<S, K>.The element at K may actually be a reference to begin with. For this purpose, you can use result_of::value_at_key<S, K>.

Expression Semantics

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.

Models

PrevUpHomeNext