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

📄 erase_key.rst

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

erase_key
=========

Synopsis
--------

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



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

Erases elements associated with the key ``Key`` in the |Extensible Associative Sequence| 
``AssocSeq`` . 

Header
------

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


Model of
--------

|Tag Dispatched Metafunction|


Parameters
----------

+---------------+-----------------------------------+-----------------------------------------------+
| Parameter     | Requirement                       | Description                                   |
+===============+===================================+===============================================+
| ``AssocSeq``  | |Extensible Associative Sequence| | A sequence to erase elements from.            |
+---------------+-----------------------------------+-----------------------------------------------+
| ``Key``       | Any type                          | A key for the elements to be removed.         |
+---------------+-----------------------------------+-----------------------------------------------+


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

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


.. parsed-literal::

    typedef erase_key<s,key>::type r; 

:Return type:
    |Extensible Associative Sequence|.
    
:Semantics:
    ``r`` is |concept-identical| and equivalent to ``s`` except that 
    ``has_key<r,k>::value == false``.

:Postcondition:
    ``size<r>::value == size<s>::value - 1``. 



Complexity
----------

Amortized constant time.


Example
-------

.. parsed-literal::
    
    typedef map< pair<int,unsigned>, pair<char,long> > m;
    typedef erase_key<m,char>::type m1;

    BOOST_MPL_ASSERT_RELATION( size<m1>::type::value, ==, 1 );
    BOOST_MPL_ASSERT(( is_same< at<m1,char>::type,void\_ > ));
    BOOST_MPL_ASSERT(( is_same< at<m1,int>::type,unsigned > ));


See also
--------

|Extensible Associative Sequence|, |erase|, |has_key|, |insert|

⌨️ 快捷键说明

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