![]() |
Home | Libraries | People | FAQ | More |
Returns the element associated with a Key from the sequence.
template <typename Key, typename Sequence> typenameresult_of::at_key
<Sequence, Key>::type at_key(Sequence& seq); template <typename Key, typename Sequence> typenameresult_of::at_key
<Sequence const, Key>::type at_key(Sequence const& seq);
Parameter |
Requirement |
Description |
---|---|---|
|
Model of Associative Sequence |
The sequence we wish to investigate. |
|
Any type |
The queried key. |
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 convertible to the element associated with Key.
Precondition: has_key<Key>(seq) == true
(where seq
is not Unbounded
Sequence)
Semantics: Returns the element associated with Key.
#include <boost/fusion/sequence/intrinsic/at_key.hpp> #include <boost/fusion/include/at_key.hpp>
set
<int, char, bool> s(1, 'x', true);
assert(at_key<char>(s) == 'x');