29 #ifndef _GLIBCXX_PROFILE_MULTIMAP_H
30 #define _GLIBCXX_PROFILE_MULTIMAP_H 1
34 namespace std _GLIBCXX_VISIBILITY(default)
39 template<
typename _Key,
typename _Tp,
typename _Compare = std::less<_Key>,
40 typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > >
42 :
public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
44 typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator>
_Base;
48 typedef _Key key_type;
49 typedef _Tp mapped_type;
51 typedef _Compare key_compare;
52 typedef _Allocator allocator_type;
53 typedef typename _Base::reference reference;
54 typedef typename _Base::const_reference const_reference;
56 typedef typename _Base::iterator iterator;
57 typedef typename _Base::const_iterator const_iterator;
58 typedef typename _Base::reverse_iterator reverse_iterator;
59 typedef typename _Base::const_reverse_iterator const_reverse_iterator;
61 typedef typename _Base::size_type size_type;
62 typedef typename _Base::difference_type difference_type;
63 typedef typename _Base::pointer pointer;
64 typedef typename _Base::const_pointer const_pointer;
67 explicit multimap(
const _Compare& __comp = _Compare(),
68 const _Allocator& __a = _Allocator())
69 :
_Base(__comp, __a) { }
71 template<
typename _InputIterator>
72 multimap(_InputIterator __first, _InputIterator __last,
73 const _Compare& __comp = _Compare(),
74 const _Allocator& __a = _Allocator())
75 :
_Base(__first, __last, __comp, __a) { }
83 #ifdef __GXX_EXPERIMENTAL_CXX0X__
86 :
_Base(std::move(__x))
90 const _Compare& __c = _Compare(),
91 const allocator_type& __a = allocator_type())
92 :
_Base(__l, __c, __a) { }
100 *
static_cast<_Base*
>(
this) = __x;
104 #ifdef __GXX_EXPERIMENTAL_CXX0X__
124 using _Base::get_allocator;
128 begin() _GLIBCXX_NOEXCEPT
129 {
return iterator(_Base::begin()); }
132 begin()
const _GLIBCXX_NOEXCEPT
133 {
return const_iterator(_Base::begin()); }
136 end() _GLIBCXX_NOEXCEPT
137 {
return iterator(_Base::end()); }
140 end()
const _GLIBCXX_NOEXCEPT
141 {
return const_iterator(_Base::end()); }
144 rbegin() _GLIBCXX_NOEXCEPT
145 {
return reverse_iterator(end()); }
147 const_reverse_iterator
148 rbegin()
const _GLIBCXX_NOEXCEPT
149 {
return const_reverse_iterator(end()); }
152 rend() _GLIBCXX_NOEXCEPT
153 {
return reverse_iterator(begin()); }
155 const_reverse_iterator
156 rend()
const _GLIBCXX_NOEXCEPT
157 {
return const_reverse_iterator(begin()); }
159 #ifdef __GXX_EXPERIMENTAL_CXX0X__
161 cbegin()
const noexcept
162 {
return const_iterator(_Base::begin()); }
165 cend()
const noexcept
166 {
return const_iterator(_Base::end()); }
168 const_reverse_iterator
169 crbegin()
const noexcept
170 {
return const_reverse_iterator(end()); }
172 const_reverse_iterator
173 crend()
const noexcept
174 {
return const_reverse_iterator(begin()); }
180 using _Base::max_size;
185 {
return iterator(_Base::insert(__x)); }
187 #ifdef __GXX_EXPERIMENTAL_CXX0X__
188 template<
typename _Pair,
typename =
typename
190 _Pair&&>::value>::type>
193 {
return iterator(_Base::insert(std::forward<_Pair>(__x))); }
196 #ifdef __GXX_EXPERIMENTAL_CXX0X__
199 { _Base::insert(__list); }
203 #ifdef __GXX_EXPERIMENTAL_CXX0X__
204 insert(const_iterator __position,
const value_type& __x)
206 insert(iterator __position,
const value_type& __x)
208 {
return iterator(_Base::insert(__position, __x)); }
210 #ifdef __GXX_EXPERIMENTAL_CXX0X__
211 template<
typename _Pair,
typename =
typename
213 _Pair&&>::value>::type>
215 insert(const_iterator __position, _Pair&& __x)
216 {
return iterator(_Base::insert(__position,
217 std::forward<_Pair>(__x))); }
220 template<
typename _InputIterator>
222 insert(_InputIterator __first, _InputIterator __last)
223 { _Base::insert(__first, __last); }
225 #ifdef __GXX_EXPERIMENTAL_CXX0X__
227 erase(const_iterator __position)
228 {
return iterator(_Base::erase(__position)); }
231 erase(iterator __position)
232 {
return iterator(_Base::erase(__position)); }
235 erase(iterator __position)
236 { _Base::erase(__position); }
240 erase(
const key_type& __x)
243 size_type __count = 0;
246 iterator __victim = __victims.
first++;
247 _Base::erase(__victim);
253 #ifdef __GXX_EXPERIMENTAL_CXX0X__
255 erase(const_iterator __first, const_iterator __last)
256 {
return iterator(_Base::erase(__first, __last)); }
259 erase(iterator __first, iterator __last)
260 { _Base::erase(__first, __last); }
265 { _Base::swap(__x); }
268 clear() _GLIBCXX_NOEXCEPT
269 { this->erase(begin(), end()); }
272 using _Base::key_comp;
273 using _Base::value_comp;
277 find(
const key_type& __x)
278 {
return iterator(_Base::find(__x)); }
281 find(
const key_type& __x)
const
282 {
return const_iterator(_Base::find(__x)); }
287 lower_bound(
const key_type& __x)
288 {
return iterator(_Base::lower_bound(__x)); }
291 lower_bound(
const key_type& __x)
const
292 {
return const_iterator(_Base::lower_bound(__x)); }
295 upper_bound(
const key_type& __x)
296 {
return iterator(_Base::upper_bound(__x)); }
299 upper_bound(
const key_type& __x)
const
300 {
return const_iterator(_Base::upper_bound(__x)); }
303 equal_range(
const key_type& __x)
305 typedef typename _Base::iterator _Base_iterator;
307 _Base::equal_range(__x);
313 equal_range(
const key_type& __x)
const
315 typedef typename _Base::const_iterator _Base_const_iterator;
317 _Base::equal_range(__x);
319 const_iterator(__res.
second));
323 _M_base() _GLIBCXX_NOEXCEPT {
return *
this; }
326 _M_base()
const _GLIBCXX_NOEXCEPT {
return *
this; }
329 template<
typename _Key,
typename _Tp,
330 typename _Compare,
typename _Allocator>
334 {
return __lhs._M_base() == __rhs._M_base(); }
336 template<
typename _Key,
typename _Tp,
337 typename _Compare,
typename _Allocator>
341 {
return __lhs._M_base() != __rhs._M_base(); }
343 template<
typename _Key,
typename _Tp,
344 typename _Compare,
typename _Allocator>
346 operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
347 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
348 {
return __lhs._M_base() < __rhs._M_base(); }
350 template<
typename _Key,
typename _Tp,
351 typename _Compare,
typename _Allocator>
353 operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
354 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
355 {
return __lhs._M_base() <= __rhs._M_base(); }
357 template<
typename _Key,
typename _Tp,
358 typename _Compare,
typename _Allocator>
360 operator>=(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
361 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
362 {
return __lhs._M_base() >= __rhs._M_base(); }
364 template<
typename _Key,
typename _Tp,
365 typename _Compare,
typename _Allocator>
367 operator>(
const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
368 const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
369 {
return __lhs._M_base() > __rhs._M_base(); }
371 template<
typename _Key,
typename _Tp,
372 typename _Compare,
typename _Allocator>
374 swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs,
375 multimap<_Key, _Tp, _Compare, _Allocator>& __rhs)
376 { __lhs.swap(__rhs); }
_T1 first
second_type is the second bound type
_T2 second
first is a copy of the first object
Define a member typedef type only if a boolean constant is true.
size_t count() const _GLIBCXX_NOEXCEPT
Returns the number of bits which are set.
A standard container made up of (key,value) pairs, which can be retrieved based on a key...
Struct holding two objects of arbitrary type.
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair(_T1 &&__x, _T2 &&__y)
A convenience wrapper for creating a pair from two objects.
is_nothrow_copy_constructible
Class std::multimap wrapper with performance instrumentation.
constexpr size_t size() const _GLIBCXX_NOEXCEPT
Returns the total number of bits.