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.
Front Page / Sequences / Intrinsic Metafunctions / is_sequence

is_sequence

Synopsis

template<
      typename X
    >
struct is_sequence
{
    typedef unspecified type;
};

Description

Returns a boolean Integral Constant c such that c::value == true if and only if X is a model of Forward Sequence.

Header

#include <boost/mpl/is_sequence.hpp>

Parameters

Parameter Requirement Description
X Any type The type to query.

Expression semantics

typedef is_sequence<X>::type c;
Return type:

Boolean Integral Constant.

Semantics:

Equivalent to

typedef not_< is_same< begin<T>::type,void_ > >::type c;

Complexity

Amortized constant time.

Example

struct UDT {};

BOOST_MPL_ASSERT_NOT(( is_sequence< std::vector<int> > ));
BOOST_MPL_ASSERT_NOT(( is_sequence< int > ));
BOOST_MPL_ASSERT_NOT(( is_sequence< int& > ));
BOOST_MPL_ASSERT_NOT(( is_sequence< UDT > ));
BOOST_MPL_ASSERT_NOT(( is_sequence< UDT* > ));
BOOST_MPL_ASSERT(( is_sequence< range_c<int,0,0> > ));
BOOST_MPL_ASSERT(( is_sequence< list<> > ));
BOOST_MPL_ASSERT(( is_sequence< list<int> > ));
BOOST_MPL_ASSERT(( is_sequence< vector<> > ));
BOOST_MPL_ASSERT(( is_sequence< vector<int> > ));

See also

Forward Sequence, begin, end, vector, list, range_c