Front Page / Macros / Introspection / BOOST_MPL_GET_TAG_DEF

BOOST_MPL_GET_TAG_DEF

Synopsis

#define BOOST_MPL_GET_TAG_DEF(name) \
    unspecified token sequence \
/**/

Description

Expands into a definition of a lazy getter Metafunction get_tag_name such that for any type x get_tag_name<x>::type is type where name is a nested type member of x.

Header

#include <boost/mpl/get_tag.hpp>

Parameters

Parameter Requirement Description
name A legal identifier token A name of the member to get.

Expression semantics

For any legal C++ identifier name:

BOOST_MPL_GET_TAG_DEF(name)
Precondition:

Appears at namespace scope.

Return type:

None.

Semantics:

Equivalent to

namespace boost { namespace mpl {
template<class T>
struct get_##name {
	typedef typename T::name type;
};
}}

Example

struct test_type_get_tag_def;

BOOST_MPL_GET_TAG_DEF(a_tag);

namespace boost { namespace mpl {

struct test_type_get_tag_def
{
	typedef int a_tag;
};

}}

typedef boost::mpl::get_a_tag<test_type_get_tag_def>::type   got_the_tag;

See also

Macros, BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF