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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
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.29. Parameters

Parameter

Requirement

Description

Seq

A model of Forward 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.

/sequence/intrinsic/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