]>
Commit | Line | Data |
---|---|---|
1218d701 SR |
1 | // Profiling map implementation -*- C++ -*- |
2 | ||
aa118a03 | 3 | // Copyright (C) 2009-2014 Free Software Foundation, Inc. |
1218d701 SR |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
4bee90f7 | 8 | // Free Software Foundation; either version 3, or (at your option) |
1218d701 | 9 | // any later version. |
4bee90f7 | 10 | // |
1218d701 SR |
11 | // This library is distributed in the hope that it will be useful, |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
1889b253 PC |
15 | |
16 | // Under Section 7 of GPL version 3, you are granted additional | |
17 | // permissions described in the GCC Runtime Library Exception, version | |
18 | // 3.1, as published by the Free Software Foundation. | |
19 | ||
1218d701 | 20 | // You should have received a copy of the GNU General Public License along |
4bee90f7 PC |
21 | // with this library; see the file COPYING3. If not see |
22 | // <http://www.gnu.org/licenses/>. | |
1218d701 SR |
23 | |
24 | /** @file profile/map.h | |
25 | * This file is a GNU profile extension to the Standard C++ Library. | |
26 | */ | |
27 | ||
28 | #ifndef _GLIBCXX_PROFILE_MAP_H | |
29 | #define _GLIBCXX_PROFILE_MAP_H 1 | |
30 | ||
31 | #include <utility> | |
32 | #include <profile/base.h> | |
33 | ||
12ffa228 | 34 | namespace std _GLIBCXX_VISIBILITY(default) |
1218d701 SR |
35 | { |
36 | namespace __profile | |
37 | { | |
9ee6a740 | 38 | /// Class std::map wrapper with performance instrumentation. |
1218d701 SR |
39 | template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>, |
40 | typename _Allocator = std::allocator<std::pair<const _Key, _Tp> > > | |
41 | class map | |
12ffa228 | 42 | : public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> |
1218d701 | 43 | { |
12ffa228 | 44 | typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> _Base; |
1218d701 | 45 | |
1217ee06 FD |
46 | #if __cplusplus >= 201103L |
47 | typedef __gnu_cxx::__alloc_traits<_Allocator> _Alloc_traits; | |
48 | #endif | |
49 | ||
1218d701 SR |
50 | public: |
51 | // types: | |
52 | typedef _Key key_type; | |
53 | typedef _Tp mapped_type; | |
54 | typedef std::pair<const _Key, _Tp> value_type; | |
55 | typedef _Compare key_compare; | |
56 | typedef _Allocator allocator_type; | |
57 | typedef typename _Base::reference reference; | |
58 | typedef typename _Base::const_reference const_reference; | |
59 | ||
60 | typedef typename _Base::iterator iterator; | |
61 | typedef typename _Base::const_iterator const_iterator; | |
62 | typedef typename _Base::size_type size_type; | |
63 | typedef typename _Base::difference_type difference_type; | |
64 | typedef typename _Base::pointer pointer; | |
65 | typedef typename _Base::const_pointer const_pointer; | |
66 | typedef std::reverse_iterator<iterator> reverse_iterator; | |
67 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; | |
68 | ||
1218d701 | 69 | // 23.3.1.1 construct/copy/destroy: |
c3cdd71f JW |
70 | |
71 | map() | |
72 | : _Base() | |
73 | { __profcxx_map_to_unordered_map_construct(this); } | |
74 | ||
c7d42abb | 75 | explicit |
c3cdd71f | 76 | map(const _Compare& __comp, |
c7d42abb PC |
77 | const _Allocator& __a = _Allocator()) |
78 | : _Base(__comp, __a) | |
79 | { __profcxx_map_to_unordered_map_construct(this); } | |
1218d701 | 80 | |
734f5023 | 81 | #if __cplusplus >= 201103L |
3c7d8b03 JW |
82 | template<typename _InputIterator, |
83 | typename = std::_RequireInputIter<_InputIterator>> | |
84 | #else | |
1218d701 | 85 | template<typename _InputIterator> |
3c7d8b03 | 86 | #endif |
1218d701 SR |
87 | map(_InputIterator __first, _InputIterator __last, |
88 | const _Compare& __comp = _Compare(), | |
89 | const _Allocator& __a = _Allocator()) | |
c7d42abb PC |
90 | : _Base(__first, __last, __comp, __a) |
91 | { __profcxx_map_to_unordered_map_construct(this); } | |
1218d701 SR |
92 | |
93 | map(const map& __x) | |
c7d42abb PC |
94 | : _Base(__x) |
95 | { __profcxx_map_to_unordered_map_construct(this); } | |
1218d701 SR |
96 | |
97 | map(const _Base& __x) | |
c7d42abb PC |
98 | : _Base(__x) |
99 | { __profcxx_map_to_unordered_map_construct(this); } | |
1218d701 | 100 | |
734f5023 | 101 | #if __cplusplus >= 201103L |
1218d701 | 102 | map(map&& __x) |
6f59ea25 | 103 | noexcept(is_nothrow_copy_constructible<_Compare>::value) |
5f1fd346 | 104 | : _Base(std::move(__x)) |
1217ee06 | 105 | { __profcxx_map_to_unordered_map_construct(this); } |
1218d701 SR |
106 | |
107 | map(initializer_list<value_type> __l, | |
108 | const _Compare& __c = _Compare(), | |
109 | const allocator_type& __a = allocator_type()) | |
1217ee06 FD |
110 | : _Base(__l, __c, __a) |
111 | { __profcxx_map_to_unordered_map_construct(this); } | |
112 | ||
113 | explicit | |
114 | map(const allocator_type& __a) | |
115 | : _Base(__a) | |
116 | { __profcxx_map_to_unordered_map_construct(this); } | |
117 | ||
118 | map(const map& __x, const allocator_type& __a) | |
119 | : _Base(__x, __a) | |
120 | { __profcxx_map_to_unordered_map_construct(this); } | |
121 | ||
122 | map(map&& __x, const allocator_type& __a) | |
123 | noexcept(is_nothrow_copy_constructible<_Compare>::value | |
124 | && _Alloc_traits::_S_always_equal()) | |
125 | : _Base(std::move(__x), __a) | |
126 | { __profcxx_map_to_unordered_map_construct(this); } | |
127 | ||
128 | map(initializer_list<value_type> __l, const allocator_type& __a) | |
129 | : _Base(__l, __a) | |
130 | { __profcxx_map_to_unordered_map_construct(this); } | |
131 | ||
132 | template<typename _InputIterator> | |
133 | map(_InputIterator __first, _InputIterator __last, | |
134 | const allocator_type& __a) | |
135 | : _Base(__first, __last, __a) | |
136 | { __profcxx_map_to_unordered_map_construct(this); } | |
1218d701 SR |
137 | #endif |
138 | ||
6f59ea25 | 139 | ~map() _GLIBCXX_NOEXCEPT |
c7d42abb | 140 | { __profcxx_map_to_unordered_map_destruct(this); } |
1218d701 | 141 | |
1217ee06 | 142 | #if __cplusplus < 201103L |
1218d701 SR |
143 | map& |
144 | operator=(const map& __x) | |
145 | { | |
1217ee06 | 146 | _M_base() = __x; |
1218d701 SR |
147 | return *this; |
148 | } | |
1217ee06 FD |
149 | #else |
150 | map& | |
151 | operator=(const map&) = default; | |
1218d701 | 152 | |
1218d701 | 153 | map& |
1217ee06 | 154 | operator=(map&&) = default; |
1218d701 SR |
155 | |
156 | map& | |
157 | operator=(initializer_list<value_type> __l) | |
158 | { | |
1217ee06 | 159 | _M_base() = __l; |
1218d701 SR |
160 | return *this; |
161 | } | |
162 | #endif | |
163 | ||
164 | // _GLIBCXX_RESOLVE_LIB_DEFECTS | |
165 | // 133. map missing get_allocator() | |
166 | using _Base::get_allocator; | |
167 | ||
168 | // iterators: | |
169 | iterator | |
d3677132 | 170 | begin() _GLIBCXX_NOEXCEPT |
1218d701 SR |
171 | { return _Base::begin(); } |
172 | ||
173 | const_iterator | |
d3677132 | 174 | begin() const _GLIBCXX_NOEXCEPT |
1218d701 SR |
175 | { return _Base::begin(); } |
176 | ||
177 | iterator | |
d3677132 | 178 | end() _GLIBCXX_NOEXCEPT |
1218d701 SR |
179 | { return _Base::end(); } |
180 | ||
181 | const_iterator | |
d3677132 | 182 | end() const _GLIBCXX_NOEXCEPT |
1218d701 SR |
183 | { return _Base::end(); } |
184 | ||
185 | reverse_iterator | |
d3677132 | 186 | rbegin() _GLIBCXX_NOEXCEPT |
1218d701 SR |
187 | { |
188 | __profcxx_map_to_unordered_map_invalidate(this); | |
189 | return reverse_iterator(end()); | |
190 | } | |
191 | ||
192 | const_reverse_iterator | |
d3677132 | 193 | rbegin() const _GLIBCXX_NOEXCEPT |
1218d701 SR |
194 | { |
195 | __profcxx_map_to_unordered_map_invalidate(this); | |
196 | return const_reverse_iterator(end()); | |
197 | } | |
198 | ||
199 | reverse_iterator | |
d3677132 | 200 | rend() _GLIBCXX_NOEXCEPT |
1218d701 SR |
201 | { |
202 | __profcxx_map_to_unordered_map_invalidate(this); | |
203 | return reverse_iterator(begin()); | |
204 | } | |
205 | ||
206 | const_reverse_iterator | |
d3677132 | 207 | rend() const _GLIBCXX_NOEXCEPT |
1218d701 SR |
208 | { |
209 | __profcxx_map_to_unordered_map_invalidate(this); | |
210 | return const_reverse_iterator(begin()); | |
211 | } | |
212 | ||
734f5023 | 213 | #if __cplusplus >= 201103L |
1218d701 | 214 | const_iterator |
d3677132 | 215 | cbegin() const noexcept |
1218d701 SR |
216 | { return const_iterator(_Base::begin()); } |
217 | ||
218 | const_iterator | |
d3677132 | 219 | cend() const noexcept |
1218d701 SR |
220 | { return const_iterator(_Base::end()); } |
221 | ||
222 | const_reverse_iterator | |
d3677132 | 223 | crbegin() const noexcept |
1218d701 SR |
224 | { |
225 | __profcxx_map_to_unordered_map_invalidate(this); | |
226 | return const_reverse_iterator(end()); | |
227 | } | |
228 | ||
229 | const_reverse_iterator | |
d3677132 | 230 | crend() const noexcept |
1218d701 SR |
231 | { |
232 | __profcxx_map_to_unordered_map_invalidate(this); | |
233 | return const_reverse_iterator(begin()); | |
234 | } | |
235 | #endif | |
236 | ||
237 | // capacity: | |
238 | using _Base::empty; | |
239 | using _Base::size; | |
240 | using _Base::max_size; | |
241 | ||
242 | // 23.3.1.2 element access: | |
243 | mapped_type& | |
244 | operator[](const key_type& __k) | |
245 | { | |
246 | __profcxx_map_to_unordered_map_find(this, size()); | |
247 | return _Base::operator[](__k); | |
248 | } | |
249 | ||
734f5023 | 250 | #if __cplusplus >= 201103L |
e6a05448 PC |
251 | mapped_type& |
252 | operator[](key_type&& __k) | |
253 | { | |
254 | __profcxx_map_to_unordered_map_find(this, size()); | |
255 | return _Base::operator[](std::move(__k)); | |
256 | } | |
257 | #endif | |
258 | ||
1218d701 SR |
259 | mapped_type& |
260 | at(const key_type& __k) | |
261 | { | |
262 | __profcxx_map_to_unordered_map_find(this, size()); | |
263 | return _Base::at(__k); | |
264 | } | |
265 | ||
266 | const mapped_type& | |
267 | at(const key_type& __k) const | |
268 | { | |
269 | __profcxx_map_to_unordered_map_find(this, size()); | |
270 | return _Base::at(__k); | |
271 | } | |
272 | ||
273 | // modifiers: | |
734f5023 | 274 | #if __cplusplus >= 201103L |
55826ab6 FD |
275 | template<typename... _Args> |
276 | std::pair<iterator, bool> | |
277 | emplace(_Args&&... __args) | |
278 | { | |
279 | __profcxx_map_to_unordered_map_insert(this, size(), 1); | |
280 | auto __res = _Base::emplace(std::forward<_Args>(__args)...); | |
281 | return std::pair<iterator, bool>(iterator(__res.first), | |
282 | __res.second); | |
283 | } | |
284 | ||
285 | template<typename... _Args> | |
286 | iterator | |
287 | emplace_hint(const_iterator __pos, _Args&&... __args) | |
288 | { | |
289 | size_type size_before = size(); | |
3c7d8b03 | 290 | auto __res = _Base::emplace_hint(__pos, |
0a011b17 | 291 | std::forward<_Args>(__args)...); |
55826ab6 FD |
292 | __profcxx_map_to_unordered_map_insert(this, size_before, |
293 | size() - size_before); | |
31828bd3 | 294 | return __res; |
55826ab6 FD |
295 | } |
296 | #endif | |
297 | ||
1218d701 SR |
298 | std::pair<iterator, bool> |
299 | insert(const value_type& __x) | |
300 | { | |
301 | __profcxx_map_to_unordered_map_insert(this, size(), 1); | |
302 | typedef typename _Base::iterator _Base_iterator; | |
303 | std::pair<_Base_iterator, bool> __res = _Base::insert(__x); | |
304 | return std::pair<iterator, bool>(iterator(__res.first), | |
305 | __res.second); | |
306 | } | |
307 | ||
734f5023 | 308 | #if __cplusplus >= 201103L |
e6a05448 | 309 | template<typename _Pair, typename = typename |
57cee56a PC |
310 | std::enable_if<std::is_constructible<value_type, |
311 | _Pair&&>::value>::type> | |
e6a05448 PC |
312 | std::pair<iterator, bool> |
313 | insert(_Pair&& __x) | |
314 | { | |
315 | __profcxx_map_to_unordered_map_insert(this, size(), 1); | |
316 | typedef typename _Base::iterator _Base_iterator; | |
317 | std::pair<_Base_iterator, bool> __res | |
318 | = _Base::insert(std::forward<_Pair>(__x)); | |
319 | return std::pair<iterator, bool>(iterator(__res.first), | |
320 | __res.second); | |
321 | } | |
322 | #endif | |
323 | ||
734f5023 | 324 | #if __cplusplus >= 201103L |
1218d701 SR |
325 | void |
326 | insert(std::initializer_list<value_type> __list) | |
327 | { | |
328 | size_type size_before = size(); | |
329 | _Base::insert(__list); | |
330 | __profcxx_map_to_unordered_map_insert(this, size_before, | |
7606bd11 | 331 | size() - size_before); |
1218d701 SR |
332 | } |
333 | #endif | |
334 | ||
335 | iterator | |
734f5023 | 336 | #if __cplusplus >= 201103L |
7606bd11 PC |
337 | insert(const_iterator __position, const value_type& __x) |
338 | #else | |
1218d701 | 339 | insert(iterator __position, const value_type& __x) |
7606bd11 | 340 | #endif |
1218d701 SR |
341 | { |
342 | size_type size_before = size(); | |
7606bd11 | 343 | iterator __i = iterator(_Base::insert(__position, __x)); |
55826ab6 | 344 | __profcxx_map_to_unordered_map_insert(this, size_before, |
7606bd11 PC |
345 | size() - size_before); |
346 | return __i; | |
1218d701 SR |
347 | } |
348 | ||
734f5023 | 349 | #if __cplusplus >= 201103L |
e6a05448 | 350 | template<typename _Pair, typename = typename |
57cee56a PC |
351 | std::enable_if<std::is_constructible<value_type, |
352 | _Pair&&>::value>::type> | |
e6a05448 PC |
353 | iterator |
354 | insert(const_iterator __position, _Pair&& __x) | |
355 | { | |
356 | size_type size_before = size(); | |
357 | iterator __i | |
358 | = iterator(_Base::insert(__position, std::forward<_Pair>(__x))); | |
359 | __profcxx_map_to_unordered_map_insert(this, size_before, | |
360 | size() - size_before); | |
361 | return __i; | |
362 | } | |
363 | #endif | |
364 | ||
734f5023 | 365 | #if __cplusplus >= 201103L |
3c7d8b03 JW |
366 | template<typename _InputIterator, |
367 | typename = std::_RequireInputIter<_InputIterator>> | |
368 | #else | |
1218d701 | 369 | template<typename _InputIterator> |
3c7d8b03 | 370 | #endif |
1218d701 SR |
371 | void |
372 | insert(_InputIterator __first, _InputIterator __last) | |
373 | { | |
374 | size_type size_before = size(); | |
375 | _Base::insert(__first, __last); | |
376 | __profcxx_map_to_unordered_map_insert(this, size_before, | |
377 | size() - size_before); | |
378 | } | |
379 | ||
734f5023 | 380 | #if __cplusplus >= 201103L |
1218d701 | 381 | iterator |
7606bd11 | 382 | erase(const_iterator __position) |
1218d701 SR |
383 | { |
384 | iterator __i = _Base::erase(__position); | |
385 | __profcxx_map_to_unordered_map_erase(this, size(), 1); | |
386 | return __i; | |
387 | } | |
6dc88283 PC |
388 | |
389 | iterator | |
390 | erase(iterator __position) | |
391 | { return erase(const_iterator(__position)); } | |
1218d701 SR |
392 | #else |
393 | void | |
394 | erase(iterator __position) | |
395 | { | |
396 | _Base::erase(__position); | |
397 | __profcxx_map_to_unordered_map_erase(this, size(), 1); | |
398 | } | |
399 | #endif | |
400 | ||
401 | size_type | |
402 | erase(const key_type& __x) | |
403 | { | |
404 | iterator __victim = find(__x); | |
405 | if (__victim == end()) | |
406 | return 0; | |
407 | else | |
408 | { | |
409 | _Base::erase(__victim); | |
410 | return 1; | |
411 | } | |
412 | } | |
413 | ||
734f5023 | 414 | #if __cplusplus >= 201103L |
5ab06c6d | 415 | iterator |
7606bd11 PC |
416 | erase(const_iterator __first, const_iterator __last) |
417 | { return iterator(_Base::erase(__first, __last)); } | |
5ab06c6d | 418 | #else |
1218d701 SR |
419 | void |
420 | erase(iterator __first, iterator __last) | |
7606bd11 | 421 | { _Base::erase(__first, __last); } |
5ab06c6d | 422 | #endif |
1218d701 SR |
423 | |
424 | void | |
1218d701 | 425 | swap(map& __x) |
1217ee06 FD |
426 | #if __cplusplus >= 201103L |
427 | noexcept(_Alloc_traits::_S_nothrow_swap()) | |
428 | #endif | |
7606bd11 | 429 | { _Base::swap(__x); } |
1218d701 SR |
430 | |
431 | void | |
d3677132 | 432 | clear() _GLIBCXX_NOEXCEPT |
1218d701 SR |
433 | { this->erase(begin(), end()); } |
434 | ||
435 | // observers: | |
436 | using _Base::key_comp; | |
437 | using _Base::value_comp; | |
438 | ||
439 | // 23.3.1.3 map operations: | |
440 | iterator | |
441 | find(const key_type& __x) | |
442 | { | |
443 | __profcxx_map_to_unordered_map_find(this, size()); | |
444 | return iterator(_Base::find(__x)); | |
445 | } | |
446 | ||
447 | const_iterator | |
448 | find(const key_type& __x) const | |
449 | { | |
450 | __profcxx_map_to_unordered_map_find(this, size()); | |
451 | return const_iterator(_Base::find(__x)); | |
452 | } | |
453 | ||
454 | size_type | |
455 | count(const key_type& __x) const | |
456 | { | |
457 | __profcxx_map_to_unordered_map_find(this, size()); | |
458 | return _Base::count(__x); | |
459 | } | |
460 | ||
461 | iterator | |
462 | lower_bound(const key_type& __x) | |
463 | { | |
464 | __profcxx_map_to_unordered_map_invalidate(this); | |
465 | return iterator(_Base::lower_bound(__x)); | |
466 | } | |
467 | ||
468 | const_iterator | |
469 | lower_bound(const key_type& __x) const | |
470 | { | |
471 | __profcxx_map_to_unordered_map_invalidate(this); | |
472 | return const_iterator(_Base::lower_bound(__x)); | |
473 | } | |
474 | ||
475 | iterator | |
476 | upper_bound(const key_type& __x) | |
477 | { | |
478 | __profcxx_map_to_unordered_map_invalidate(this); | |
479 | return iterator(_Base::upper_bound(__x)); | |
480 | } | |
481 | ||
482 | const_iterator | |
483 | upper_bound(const key_type& __x) const | |
484 | { | |
485 | __profcxx_map_to_unordered_map_invalidate(this); | |
486 | return const_iterator(_Base::upper_bound(__x)); | |
487 | } | |
488 | ||
489 | std::pair<iterator,iterator> | |
490 | equal_range(const key_type& __x) | |
491 | { | |
492 | typedef typename _Base::iterator _Base_iterator; | |
493 | std::pair<_Base_iterator, _Base_iterator> __res = | |
494 | _Base::equal_range(__x); | |
495 | return std::make_pair(iterator(__res.first), | |
496 | iterator(__res.second)); | |
497 | } | |
498 | ||
499 | std::pair<const_iterator,const_iterator> | |
500 | equal_range(const key_type& __x) const | |
501 | { | |
502 | __profcxx_map_to_unordered_map_find(this, size()); | |
503 | typedef typename _Base::const_iterator _Base_const_iterator; | |
504 | std::pair<_Base_const_iterator, _Base_const_iterator> __res = | |
505 | _Base::equal_range(__x); | |
506 | return std::make_pair(const_iterator(__res.first), | |
507 | const_iterator(__res.second)); | |
508 | } | |
509 | ||
510 | _Base& | |
d3677132 | 511 | _M_base() _GLIBCXX_NOEXCEPT { return *this; } |
1218d701 SR |
512 | |
513 | const _Base& | |
d3677132 | 514 | _M_base() const _GLIBCXX_NOEXCEPT { return *this; } |
1218d701 SR |
515 | |
516 | }; | |
517 | ||
518 | template<typename _Key, typename _Tp, | |
519 | typename _Compare, typename _Allocator> | |
520 | inline bool | |
521 | operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, | |
522 | const map<_Key, _Tp, _Compare, _Allocator>& __rhs) | |
523 | { | |
524 | __profcxx_map_to_unordered_map_invalidate(&__lhs); | |
525 | __profcxx_map_to_unordered_map_invalidate(&__rhs); | |
526 | return __lhs._M_base() == __rhs._M_base(); | |
527 | } | |
528 | ||
529 | template<typename _Key, typename _Tp, | |
530 | typename _Compare, typename _Allocator> | |
531 | inline bool | |
532 | operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, | |
533 | const map<_Key, _Tp, _Compare, _Allocator>& __rhs) | |
534 | { | |
535 | __profcxx_map_to_unordered_map_invalidate(&__lhs); | |
536 | __profcxx_map_to_unordered_map_invalidate(&__rhs); | |
537 | return __lhs._M_base() != __rhs._M_base(); | |
538 | } | |
539 | ||
540 | template<typename _Key, typename _Tp, | |
541 | typename _Compare, typename _Allocator> | |
542 | inline bool | |
543 | operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, | |
544 | const map<_Key, _Tp, _Compare, _Allocator>& __rhs) | |
545 | { | |
546 | __profcxx_map_to_unordered_map_invalidate(&__lhs); | |
547 | __profcxx_map_to_unordered_map_invalidate(&__rhs); | |
548 | return __lhs._M_base() < __rhs._M_base(); | |
549 | } | |
550 | ||
551 | template<typename _Key, typename _Tp, | |
552 | typename _Compare, typename _Allocator> | |
553 | inline bool | |
554 | operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, | |
555 | const map<_Key, _Tp, _Compare, _Allocator>& __rhs) | |
556 | { | |
557 | __profcxx_map_to_unordered_map_invalidate(&__lhs); | |
558 | __profcxx_map_to_unordered_map_invalidate(&__rhs); | |
559 | return __lhs._M_base() <= __rhs._M_base(); | |
560 | } | |
561 | ||
562 | template<typename _Key, typename _Tp, | |
563 | typename _Compare, typename _Allocator> | |
564 | inline bool | |
565 | operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, | |
566 | const map<_Key, _Tp, _Compare, _Allocator>& __rhs) | |
567 | { | |
568 | __profcxx_map_to_unordered_map_invalidate(&__lhs); | |
569 | __profcxx_map_to_unordered_map_invalidate(&__rhs); | |
570 | return __lhs._M_base() >= __rhs._M_base(); | |
571 | } | |
572 | ||
573 | template<typename _Key, typename _Tp, | |
574 | typename _Compare, typename _Allocator> | |
575 | inline bool | |
576 | operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, | |
577 | const map<_Key, _Tp, _Compare, _Allocator>& __rhs) | |
578 | { | |
579 | __profcxx_map_to_unordered_map_invalidate(&__lhs); | |
580 | __profcxx_map_to_unordered_map_invalidate(&__rhs); | |
581 | return __lhs._M_base() > __rhs._M_base(); | |
582 | } | |
583 | ||
584 | template<typename _Key, typename _Tp, | |
585 | typename _Compare, typename _Allocator> | |
586 | inline void | |
587 | swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs, | |
588 | map<_Key, _Tp, _Compare, _Allocator>& __rhs) | |
589 | { __lhs.swap(__rhs); } | |
590 | ||
591 | } // namespace __profile | |
592 | } // namespace std | |
593 | ||
594 | #endif |