Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
has_key
Description

Returns a type convertible to bool that evaluates to true if the sequence contains an element associated with a Key, else, evaluates to false.

Synopsis
template <typename Key, typename Sequence>
typename result_of::has_key<Sequence, Key>::type
has_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
has_key<Key>(seq);

Return type: Convertible to bool.

Semantics: Evaluates to true if the sequence contains an element associated with Key, else, evaluates to false.

Header
#include <boost/fusion/sequence/intrinsic/has_key.hpp>
#include <boost/fusion/include/has_key.hpp>
Example
set<int, char, bool> s(1, 'x', true);
assert(has_key<char>(s) == true);

PrevUpHomeNext