has_key.rst
来自「Boost provides free peer-reviewed portab」· RST 代码 · 共 99 行
RST
99 行
.. Sequences/Intrinsic Metafunctions//has_key.. Copyright Aleksey Gurtovoy, David Abrahams 2007... Distributed under the Boost.. Software License, Version 1.0. (See accompanying.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)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 elementwith 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 + =
减小字号Ctrl + -
显示快捷键?