category_of

| Home | Libraries | People | FAQ | More

### category_of

##### Description

A metafunction that establishes the conceptual classification of a particular Sequence or Iterator (see Iterator Concepts and Sequence Concepts).

##### Synopsis

    namespace traits
    {
        template <typename T>
        struct category_of
        {
            typedef unspecified type;
        };
    }

##### Parameters

Parameter | Requirement | Description
--- | --- | ---
`T` | Any type | The type to query.

##### Expression Semantics

    typedef traits::category_of<T>::type category;

Return type:

The return type is derived from one of:

    namespace boost { namespace fusion
    {
        struct incrementable_traversal_tag {};

        struct single_pass_traversal_tag
            : incrementable_traversal_tag {};

        struct forward_traversal_tag
            : single_pass_traversal_tag {};

        struct bidirectional_traversal_tag
            : forward_traversal_tag {};

        struct random_access_traversal_tag
            : bidirectional_traversal_tag {};
    }}

And optionally from:

    namespace boost { namespace fusion
    {
        struct associative_tag {};

        struct unbounded_tag {};
    }}

Semantics: Establishes the conceptual classification of a particular Sequence or Iterator.

##### Header

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

##### Example

    using boost::is_base_of;
    typedef traits::category_of<list<> >::type list_category;
    typedef traits::category_of<vector<> >::type vector_category;
    BOOST_MPL_ASSERT(( is_base_of<forward_traversal_tag, list_category> ));
    BOOST_MPL_ASSERT(( is_base_of<random_access_traversal_tag, vector_category> ));