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

tag_of

Description

All conforming Fusion sequences and iterators have an associated tag type. The purpose of the tag is to enable tag dispatching from Intrinsic functions to implementations appropriate for the type.

This metafunction may be specialized to accomodate clients providing Fusion conforming sequences.

Synopsis

namespace traits
{
    template<typename Sequence>
    struct tag_of
    {
        typedef unspecified type;
    };
}

Parameters

Parameter

Requirement

Description

T

Any type

The type to query.

Expression Semantics

typedef traits::tag_of<T>::type tag;

Return type: Any type.

Semantics: Returns the tag type associated with T.

Header

#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/include/tag_of.hpp>

Example

typedef traits::tag_of<list<> >::type tag1;
typedef traits::tag_of<list<int> >::type tag2;
typedef traits::tag_of<vector<> >::type tag3;
typedef traits::tag_of<vector<int> >::type tag4;

BOOST_MPL_ASSERT((boost::is_same<tag1, tag2>));
BOOST_MPL_ASSERT((boost::is_same<tag3, tag4>));

PrevUpHomeNext