📄 is_sequence.rst
字号:
.. Sequences/Intrinsic Metafunctions//is_sequence
is_sequence
===========
Synopsis
--------
.. parsed-literal::
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
------
.. parsed-literal::
#include <boost/mpl/is_sequence.hpp>
Parameters
----------
+---------------+-------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================+===============================================+
| ``X`` | Any type | The type to query. |
+---------------+-------------------+-----------------------------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef is_sequence<X>::type c;
:Return type:
Boolean |Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef not_< is_same< begin<T>::type,void_ > >::type c;
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
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|
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -