| Home | Libraries | People | FAQ | More

##### at_key

###### Description

Returns the element associated with a Key from the sequence.

###### Synopsis

    template <typename Key, typename Sequence>
    typename result_of::at_key<Sequence, Key>::type
    at_key(Sequence& seq);

    template <typename Key, typename Sequence>
    typename result_of::at_key<Sequence const, Key>::type
    at_key(Sequence const& seq);

###### Parameters

Parameter | Requirement | Description
--- | --- | ---
`seq` | Model of Associative Sequence | The sequence we wish to investigate.
`Key` | Any type | The queried key.

###### Expression Semantics

    at_key<Key>(seq);

Return type: Returns a reference to the element associated with Key from the sequence `seq` if `seq` is mutable and `e = o`, where `e` is the element associated with Key, is a valid expression. Else, returns a type convertable to the element associated with Key.

Precondition: `has_key<Key>(seq) == true`

Semantics: Returns the element associated with Key.

###### Header

    #include <boost/fusion/sequence/intrinsic/at_key.hpp>
    #include <boost/fusion/include/at_key.hpp>

###### Example

    set<int, char, bool> s(1, 'x', true);
    assert(at_key<char>(s) == 'x');