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

📄 contains.rst

📁 C++的一个好库。。。现在很流行
💻 RST
字号:
.. Algorithms/Querying Algorithms//contains |30

contains
========

Synopsis
--------

.. parsed-literal::
    
    template<
          typename Sequence
        , typename T
        >
    struct contains
    {
        typedef |unspecified| type;
    };



Description
-----------

Returns a true-valued |Integral Constant| if one or more elements in ``Sequence`` 
are identical to ``T``. 


Header
------

.. parsed-literal::
    
    #include <boost/mpl/contains.hpp>


Parameters
----------

+---------------+---------------------------+-----------------------------------+
| Parameter     | Requirement               | Description                       |
+===============+===========================+===================================+
| ``Sequence``  | |Forward Sequence|        | A sequence to be examined.        |
+---------------+---------------------------+-----------------------------------+
| ``T``         | Any type                  | A type to search for.             |
+---------------+---------------------------+-----------------------------------+


Expression semantics
--------------------

For any |Forward Sequence| ``s`` and arbitrary type ``t``:


.. parsed-literal::

    typedef contains<s,t>::type r;


:Return type:
    |Integral Constant|.

:Semantics:
    Equivalent to

    .. parsed-literal::
        
        typedef not_< is_same< 
              find<s,t>::type
            , end<s>::type
            > >::type r;


Complexity
----------

Linear. At most ``size<s>::value`` comparisons for identity. 


Example
-------

.. parsed-literal::
    
    typedef vector<char,int,unsigned,long,unsigned long> types;
    BOOST_MPL_ASSERT_NOT(( contains<types,bool> ));


See also
--------

|Querying Algorithms|, |find|, |find_if|, |count|, |lower_bound|

⌨️ 快捷键说明

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