Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
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.

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

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