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

📄 has_key.rst

📁 C++的一个好库。。。现在很流行
💻 RST
字号:
.. Sequences/Intrinsic Metafunctions//has_key

has_key
=======

Synopsis
--------

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



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

Returns a true-valued |Integral Constant| if ``Sequence`` contains an element
with key ``Key``.


Header
------

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


Model of
--------

|Tag Dispatched Metafunction|


Parameters
----------

+---------------+---------------------------+-----------------------------------------------+
| Parameter     | Requirement               | Description                                   |
+===============+===========================+===============================================+
| ``Sequence``  | |Associative Sequence|    | A sequence to query.                          |
+---------------+---------------------------+-----------------------------------------------+
| ``Key``       | Any type                  | The queried key.                              |
+---------------+---------------------------+-----------------------------------------------+


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

For any |Associative Sequence| ``s``, and arbitrary type ``key``:

.. parsed-literal::

    typedef has_key<s,key>::type c; 

:Return type:
    Boolean |Integral Constant|.
    
:Semantics:
    ``c::value == true`` if ``key`` is in ``s``'s set of keys; otherwise
    ``c::value == false``.


Complexity
----------

Amortized constant time.


Example
-------

.. parsed-literal::
    
    typedef map< pair<int,unsigned>, pair<char,long> > m;
    BOOST_MPL_ASSERT_NOT(( has_key<m,long> ));

    typedef insert< m, pair<long,unsigned long> > m1;
    BOOST_MPL_ASSERT(( has_key<m1,long> ));


See also
--------

|Associative Sequence|, |count|, |insert|, |erase_key|

⌨️ 快捷键说明

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