1.. Sequences/Intrinsic Metafunctions//erase_key
2
3erase_key
4=========
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename AssocSeq
13        , typename Key
14        >
15    struct erase_key
16    {
17        typedef |unspecified| type;
18    };
19
20
21
22Description
23-----------
24
25Erases elements associated with the key ``Key`` in the |Extensible Associative Sequence|
26``AssocSeq`` .
27
28Header
29------
30
31.. parsed-literal::
32
33    #include <boost/mpl/erase_key.hpp>
34
35
36Model of
37--------
38
39|Tag Dispatched Metafunction|
40
41
42Parameters
43----------
44
45+---------------+-----------------------------------+-----------------------------------------------+
46| Parameter     | Requirement                       | Description                                   |
47+===============+===================================+===============================================+
48| ``AssocSeq``  | |Extensible Associative Sequence| | A sequence to erase elements from.            |
49+---------------+-----------------------------------+-----------------------------------------------+
50| ``Key``       | Any type                          | A key for the elements to be removed.         |
51+---------------+-----------------------------------+-----------------------------------------------+
52
53
54Expression semantics
55--------------------
56
57For any |Extensible Associative Sequence| ``s``, and arbitrary type ``key``:
58
59
60.. parsed-literal::
61
62    typedef erase_key<s,key>::type r;
63
64:Return type:
65    |Extensible Associative Sequence|.
66
67:Semantics:
68    ``r`` is |concept-identical| and equivalent to ``s`` except that
69    ``has_key<r,k>::value == false``.
70
71:Postcondition:
72    ``size<r>::value == size<s>::value - 1``.
73
74
75
76Complexity
77----------
78
79Amortized constant time.
80
81
82Example
83-------
84
85.. parsed-literal::
86
87    typedef map< pair<int,unsigned>, pair<char,long> > m;
88    typedef erase_key<m,char>::type m1;
89
90    BOOST_MPL_ASSERT_RELATION( size<m1>::type::value, ==, 1 );
91    BOOST_MPL_ASSERT(( is_same< at<m1,char>::type,void\_ > ));
92    BOOST_MPL_ASSERT(( is_same< at<m1,int>::type,unsigned > ));
93
94
95See also
96--------
97
98|Extensible Associative Sequence|, |erase|, |has_key|, |insert|
99
100
101.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
102   Distributed under the Boost Software License, Version 1.0. (See accompanying
103   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
104