Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext
has_key
Description

Returns the result type of has_key.

Synopsis
template<
    typename Seq,
    typename Key>
struct has_key
{
    typedef unspecified type;
};

Table 1.32. Parameters

Parameter

Requirement

Description

Seq

A model of Associative Sequence

Argument sequence

Key

Any type

Key type


Expression Semantics
result_of::has_key<Seq, Key>::type

Return type: An MPL Integral Constant.

Semantics: Returns mpl::true_ if Seq contains an element with key type Key, returns mpl::false_ otherwise.

Header
#include <boost/fusion/sequence/intrinsic/has_key.hpp>
#include <boost/fusion/include/has_key.hpp>
Example
typedef map<pair<int, char>, pair<char, char>, pair<double, char> > mymap;
BOOST_MPL_ASSERT((result_of::has_key<mymap, int>));
BOOST_MPL_ASSERT_NOT((result_of::has_key<mymap, void*>));

PrevUpHomeNext