⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 empty.rst

📁 C++的一个好库。。。现在很流行
💻 RST
字号:
.. 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 <boost/mpl/empty.hpp>


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<s>::type c; 

:Return type:
    Boolean |Integral Constant|.

:Semantics:
    Equivalent to ``typedef is_same< begin<s>::type,end<s>::type >::type c;``.

:Postcondition:
    ``empty<s>::value == ( size<s>::value == 0 )``.



Complexity
----------

Amortized constant time.


Example
-------

.. parsed-literal::
    
    typedef range_c<int,0,0> empty_range;
    typedef vector<long,float,double> types;
    
    BOOST_MPL_ASSERT( empty<empty_range> );
    BOOST_MPL_ASSERT_NOT( empty<types> );


See also
--------

|Forward Sequence|, |Integral Constant|, |size|, |begin| / |end|

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -