]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | .. Sequences/Intrinsic Metafunctions//is_sequence |
2 | ||
3 | is_sequence | |
4 | =========== | |
5 | ||
6 | Synopsis | |
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 | ||
21 | Description | |
22 | ----------- | |
23 | ||
24 | Returns a boolean |Integral Constant| ``c`` such that ``c::value == true`` if and | |
25 | only if ``X`` is a model of |Forward Sequence|. | |
26 | ||
27 | ||
28 | Header | |
29 | ------ | |
30 | ||
31 | .. parsed-literal:: | |
32 | ||
33 | #include <boost/mpl/is_sequence.hpp> | |
34 | ||
35 | ||
36 | Parameters | |
37 | ---------- | |
38 | ||
39 | +---------------+-------------------+-----------------------------------------------+ | |
40 | | Parameter | Requirement | Description | | |
41 | +===============+===================+===============================================+ | |
42 | | ``X`` | Any type | The type to query. | | |
43 | +---------------+-------------------+-----------------------------------------------+ | |
44 | ||
45 | ||
46 | Expression 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 | ||
66 | Complexity | |
67 | ---------- | |
68 | ||
69 | Amortized constant time. | |
70 | ||
71 | ||
72 | Example | |
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 | ||
91 | See also | |
92 | -------- | |
93 | ||
94 | |Forward Sequence|, |begin|, |end|, |vector|, |list|, |range_c| | |
95 | ||
96 | ||
97 |