Back to Arangodb

Associative Sequence

3rdParty/boost/1.78.0/libs/mpl/doc/refmanual/associative-sequence.html

3.12.9.14.3 KB
Original Source

| Prev Next | Back Along | Up Home | Full TOC | Front Page / Sequences / Concepts / Associative Sequence |

Associative Sequence

Description

An Associative Sequence is a Forward Sequence that allows efficient retrieval of elements based on keys. Unlike associative containers in the C++ Standard Library, MPL associative sequences have no associated 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.

Definitions

  • A key is a part of the element type used to identify and retrieve the element within the sequence.
  • A value is a part of the element type retrievied from the sequence by its key.

Expression requirements

In the following table and subsequent specifications, s is an Associative Sequence, x is a sequence element, and k and def are arbitrary types.

In addition to the requirements defined in Forward Sequence, the following must be met:

ExpressionTypeComplexity
has_key<s,k>::typeBoolean Integral ConstantAmortized constant time
count<s,k>::typeIntegral ConstantAmortized constant time
order<s,k>::typeIntegral Constant or void_Amortized constant time
at<s,k>::typeAny typeAmortized constant time
at<s,k,def>::typeAny typeAmortized constant time
key_type<s,x>::typeAny typeAmortized constant time
value_type<s,x>::typeAny typeAmortized constant time

Expression semantics

The semantics of an expression are defined only where they differ from, or are not defined in Forward Sequence.

ExpressionSemantics
has_key<s,k>::typeA 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.
count<s,k>::typeThe number of elements with the key k in s; see count.
order<s,k>::typeA unique unsigned Integral Constant associated with the key k in the sequence s; see order.
[at](./at.html)<s,k>::type[at](./at.html)<s,k,def>::type

| The first element associated with the key k in the sequence s; see at. | | key_type<s,x>::type | The key part of the element x that would be used to identify x in s; see key_type. | | value_type<s,x>::type | The value part of the element x that would be used for x in s; see value_type. |

Models

See also

Sequences, Extensible Associative Sequence, has_key, count, order, at, key_type, value_type

| Prev Next | Back Along | Up Home | Full TOC |

Copyright © 2001-2009 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) |