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

key_of

Description

Returns the key type associated with the element referenced by an associative iterator.

Synopsis
template<
    typename I
    >
struct key_of
{
    typedef unspecified type;
};

Table 1.20. Parameters

Parameter

Requirement

Description

I

Model of Associative Iterator

Operation's argument


Expression Semantics
result_of::key_of<I>::type

Return type: Any type

Semantics: Returns the key type associated with the element referenced by an associative iterator I.

Header
#include <boost/fusion/iterator/key_of.hpp>
#include <boost/fusion/include/key_of.hpp>
Example
typedef map<pair<float,int> > vec;
typedef result_of::begin<vec>::type first;

BOOST_MPL_ASSERT((boost::is_same<result_of::key_of<first>::type, float>));

PrevUpHomeNext