Front Page / Sequences / Intrinsic Metafunctions / has_key |
Returns a true-valued Integral Constant if Sequence contains an element with key Key.
#include <boost/mpl/has_key.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Associative Sequence | A sequence to query. |
Key | Any type | The queried key. |
For any Associative Sequence s, and arbitrary type key:
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. |
Amortized constant time.
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> ));