1 .. Sequences/Intrinsic Metafunctions//key_type
17 typedef |unspecified| type;
25 Returns the |key| that would be used to identify ``X`` in ``Sequence``.
33 #include <boost/mpl/key_type.hpp>
39 |Tag Dispatched Metafunction|
45 +---------------+---------------------------+-----------------------------------------------+
46 | Parameter | Requirement | Description |
47 +===============+===========================+===============================================+
48 | ``Sequence`` | |Associative Sequence| | A sequence to query. |
49 +---------------+---------------------------+-----------------------------------------------+
50 | ``X`` | Any type | The type to get the |key| for. |
51 +---------------+---------------------------+-----------------------------------------------+
57 For any |Associative Sequence| ``s``, iterators ``pos1`` and ``pos2`` in ``s``, and an
62 typedef key_type<s,x>::type k;
68 ``x`` can be put in ``s``.
71 ``k`` is the |key| that would be used to identify ``x`` in ``s``.
74 If ``key_type< s,deref<pos1>::type >::type`` is identical to
75 ``key_type< s,deref<pos2>::type >::type`` then ``pos1`` is identical to ``pos2``.
82 Amortized constant time.
90 typedef key_type< map<>,pair<int,unsigned> >::type k1;
91 typedef key_type< set<>,pair<int,unsigned> >::type k2;
93 BOOST_MPL_ASSERT(( is_same< k1,int > ));
94 BOOST_MPL_ASSERT(( is_same< k2,pair<int,unsigned> > ));
100 |Associative Sequence|, |value_type|, |has_key|, |set|, |map|
103 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
104 Distributed under the Boost Software License, Version 1.0. (See accompanying
105 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)