C++的一个好库。。。现在很流行
源代码在线查看: empty.rst
软件大小: |
21075 K |
上传用户: |
lyyfengyutongzh |
|
|
关键词: |
|
下载地址: |
免注册下载 普通下载
|
|
.. Sequences/Intrinsic Metafunctions//empty
empty
=====
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
>
struct empty
{
typedef |unspecified| type;
};
Description
-----------
Returns an |Integral Constant| ``c`` such that ``c::value == true`` if
and only if the sequence is empty.
Header
------
.. parsed-literal::
#include
Model of
--------
|Tag Dispatched Metafunction|
Parameters
----------
+---------------+-----------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+=======================+===================================+
| ``Sequence`` | |Forward Sequence| | A sequence to test. |
+---------------+-----------------------+-----------------------------------+
Expression semantics
--------------------
For any |Forward Sequence| ``s``:
.. parsed-literal::
typedef empty::type c;
:Return type:
Boolean |Integral Constant|.
:Semantics:
Equivalent to ``typedef is_same< begin::type,end::type >::type c;``.
:Postcondition:
``empty::value == ( size::value == 0 )``.
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef range_c empty_range;
typedef vector types;
BOOST_MPL_ASSERT( empty );
BOOST_MPL_ASSERT_NOT( empty );
See also
--------
|Forward Sequence|, |Integral Constant|, |size|, |begin| / |end|