multimap.h 19 KB

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