• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Sequences/Intrinsic Metafunctions//is_sequence
2
3is_sequence
4===========
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename X
13        >
14    struct is_sequence
15    {
16        typedef |unspecified| type;
17    };
18
19
20
21Description
22-----------
23
24Returns a boolean |Integral Constant| ``c`` such that ``c::value == true`` if and
25only if ``X`` is a model of |Forward Sequence|.
26
27
28Header
29------
30
31.. parsed-literal::
32
33    #include <boost/mpl/is_sequence.hpp>
34
35
36Parameters
37----------
38
39+---------------+-------------------+-----------------------------------------------+
40| Parameter     | Requirement       | Description                                   |
41+===============+===================+===============================================+
42| ``X``         | Any type          | The type to query.                            |
43+---------------+-------------------+-----------------------------------------------+
44
45
46Expression semantics
47--------------------
48
49
50.. parsed-literal::
51
52    typedef is_sequence<X>::type c;
53
54:Return type:
55    Boolean |Integral Constant|.
56
57:Semantics:
58    Equivalent to
59
60    .. parsed-literal::
61
62        typedef not_< is_same< begin<T>::type,void_ > >::type c;
63
64
65
66Complexity
67----------
68
69Amortized constant time.
70
71
72Example
73-------
74
75.. parsed-literal::
76
77    struct UDT {};
78
79    BOOST_MPL_ASSERT_NOT(( is_sequence< std::vector<int> > ));
80    BOOST_MPL_ASSERT_NOT(( is_sequence< int > ));
81    BOOST_MPL_ASSERT_NOT(( is_sequence< int& > ));
82    BOOST_MPL_ASSERT_NOT(( is_sequence< UDT > ));
83    BOOST_MPL_ASSERT_NOT(( is_sequence< UDT* > ));
84    BOOST_MPL_ASSERT(( is_sequence< range_c<int,0,0> > ));
85    BOOST_MPL_ASSERT(( is_sequence< list<> > ));
86    BOOST_MPL_ASSERT(( is_sequence< list<int> > ));
87    BOOST_MPL_ASSERT(( is_sequence< vector<> > ));
88    BOOST_MPL_ASSERT(( is_sequence< vector<int> > ));
89
90
91See also
92--------
93
94|Forward Sequence|, |begin|, |end|, |vector|, |list|, |range_c|
95
96
97.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
98   Distributed under the Boost Software License, Version 1.0. (See accompanying
99   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
100