...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Returns the element associated with a Key from the sequence.
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);
Parameter |
Requirement |
Description |
---|---|---|
seq |
Model of Associative Sequence |
The sequence we wish to investigate. |
Key |
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 convertable to the element associated with Key.
Precondition: has_key<Key>(seq) == true
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');