multiset.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653
  1. // Debugging multiset implementation -*- C++ -*-
  2. // Copyright (C) 2003-2021 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 debug/multiset.h
  21. * This file is a GNU debug extension to the Standard C++ Library.
  22. */
  23. #ifndef _GLIBCXX_DEBUG_MULTISET_H
  24. #define _GLIBCXX_DEBUG_MULTISET_H 1
  25. #include <debug/safe_sequence.h>
  26. #include <debug/safe_container.h>
  27. #include <debug/safe_iterator.h>
  28. #include <utility>
  29. namespace std _GLIBCXX_VISIBILITY(default)
  30. {
  31. namespace __debug
  32. {
  33. /// Class std::multiset with safety/checking/debug instrumentation.
  34. template<typename _Key, typename _Compare = std::less<_Key>,
  35. typename _Allocator = std::allocator<_Key> >
  36. class multiset
  37. : public __gnu_debug::_Safe_container<
  38. multiset<_Key, _Compare, _Allocator>, _Allocator,
  39. __gnu_debug::_Safe_node_sequence>,
  40. public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator>
  41. {
  42. typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base;
  43. typedef __gnu_debug::_Safe_container<
  44. multiset, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe;
  45. typedef typename _Base::const_iterator _Base_const_iterator;
  46. typedef typename _Base::iterator _Base_iterator;
  47. typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal;
  48. template<typename _ItT, typename _SeqT, typename _CatT>
  49. friend class ::__gnu_debug::_Safe_iterator;
  50. // Reference wrapper for base class. Disambiguates multiset(const _Base&)
  51. // from copy constructor by requiring a user-defined conversion.
  52. // See PR libstdc++/90102.
  53. struct _Base_ref
  54. {
  55. _Base_ref(const _Base& __r) : _M_ref(__r) { }
  56. const _Base& _M_ref;
  57. };
  58. public:
  59. // types:
  60. typedef _Key key_type;
  61. typedef _Key value_type;
  62. typedef _Compare key_compare;
  63. typedef _Compare value_compare;
  64. typedef _Allocator allocator_type;
  65. typedef typename _Base::reference reference;
  66. typedef typename _Base::const_reference const_reference;
  67. typedef __gnu_debug::_Safe_iterator<_Base_iterator, multiset>
  68. iterator;
  69. typedef __gnu_debug::_Safe_iterator<_Base_const_iterator,
  70. multiset> const_iterator;
  71. typedef typename _Base::size_type size_type;
  72. typedef typename _Base::difference_type difference_type;
  73. typedef typename _Base::pointer pointer;
  74. typedef typename _Base::const_pointer const_pointer;
  75. typedef std::reverse_iterator<iterator> reverse_iterator;
  76. typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
  77. // 23.3.3.1 construct/copy/destroy:
  78. #if __cplusplus < 201103L
  79. multiset() : _Base() { }
  80. multiset(const multiset& __x)
  81. : _Base(__x) { }
  82. ~multiset() { }
  83. #else
  84. multiset() = default;
  85. multiset(const multiset&) = default;
  86. multiset(multiset&&) = default;
  87. multiset(initializer_list<value_type> __l,
  88. const _Compare& __comp = _Compare(),
  89. const allocator_type& __a = allocator_type())
  90. : _Base(__l, __comp, __a) { }
  91. explicit
  92. multiset(const allocator_type& __a)
  93. : _Base(__a) { }
  94. multiset(const multiset& __m, const allocator_type& __a)
  95. : _Base(__m, __a) { }
  96. multiset(multiset&& __m, const allocator_type& __a)
  97. noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
  98. : _Safe(std::move(__m._M_safe()), __a),
  99. _Base(std::move(__m._M_base()), __a) { }
  100. multiset(initializer_list<value_type> __l, const allocator_type& __a)
  101. : _Base(__l, __a)
  102. { }
  103. template<typename _InputIterator>
  104. multiset(_InputIterator __first, _InputIterator __last,
  105. const allocator_type& __a)
  106. : _Base(__gnu_debug::__base(
  107. __glibcxx_check_valid_constructor_range(__first, __last)),
  108. __gnu_debug::__base(__last), __a) { }
  109. ~multiset() = default;
  110. #endif
  111. explicit multiset(const _Compare& __comp,
  112. const _Allocator& __a = _Allocator())
  113. : _Base(__comp, __a) { }
  114. template<typename _InputIterator>
  115. multiset(_InputIterator __first, _InputIterator __last,
  116. const _Compare& __comp = _Compare(),
  117. const _Allocator& __a = _Allocator())
  118. : _Base(__gnu_debug::__base(
  119. __glibcxx_check_valid_constructor_range(__first, __last)),
  120. __gnu_debug::__base(__last),
  121. __comp, __a) { }
  122. multiset(_Base_ref __x)
  123. : _Base(__x._M_ref) { }
  124. #if __cplusplus < 201103L
  125. multiset&
  126. operator=(const multiset& __x)
  127. {
  128. this->_M_safe() = __x;
  129. _M_base() = __x;
  130. return *this;
  131. }
  132. #else
  133. multiset&
  134. operator=(const multiset&) = default;
  135. multiset&
  136. operator=(multiset&&) = default;
  137. multiset&
  138. operator=(initializer_list<value_type> __l)
  139. {
  140. _M_base() = __l;
  141. this->_M_invalidate_all();
  142. return *this;
  143. }
  144. #endif
  145. using _Base::get_allocator;
  146. // iterators:
  147. iterator
  148. begin() _GLIBCXX_NOEXCEPT
  149. { return iterator(_Base::begin(), this); }
  150. const_iterator
  151. begin() const _GLIBCXX_NOEXCEPT
  152. { return const_iterator(_Base::begin(), this); }
  153. iterator
  154. end() _GLIBCXX_NOEXCEPT
  155. { return iterator(_Base::end(), this); }
  156. const_iterator
  157. end() const _GLIBCXX_NOEXCEPT
  158. { return const_iterator(_Base::end(), this); }
  159. reverse_iterator
  160. rbegin() _GLIBCXX_NOEXCEPT
  161. { return reverse_iterator(end()); }
  162. const_reverse_iterator
  163. rbegin() const _GLIBCXX_NOEXCEPT
  164. { return const_reverse_iterator(end()); }
  165. reverse_iterator
  166. rend() _GLIBCXX_NOEXCEPT
  167. { return reverse_iterator(begin()); }
  168. const_reverse_iterator
  169. rend() const _GLIBCXX_NOEXCEPT
  170. { return const_reverse_iterator(begin()); }
  171. #if __cplusplus >= 201103L
  172. const_iterator
  173. cbegin() const noexcept
  174. { return const_iterator(_Base::begin(), this); }
  175. const_iterator
  176. cend() const noexcept
  177. { return const_iterator(_Base::end(), this); }
  178. const_reverse_iterator
  179. crbegin() const noexcept
  180. { return const_reverse_iterator(end()); }
  181. const_reverse_iterator
  182. crend() const noexcept
  183. { return const_reverse_iterator(begin()); }
  184. #endif
  185. // capacity:
  186. using _Base::empty;
  187. using _Base::size;
  188. using _Base::max_size;
  189. // modifiers:
  190. #if __cplusplus >= 201103L
  191. template<typename... _Args>
  192. iterator
  193. emplace(_Args&&... __args)
  194. { return { _Base::emplace(std::forward<_Args>(__args)...), this }; }
  195. template<typename... _Args>
  196. iterator
  197. emplace_hint(const_iterator __pos, _Args&&... __args)
  198. {
  199. __glibcxx_check_insert(__pos);
  200. return
  201. {
  202. _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...),
  203. this
  204. };
  205. }
  206. #endif
  207. iterator
  208. insert(const value_type& __x)
  209. { return iterator(_Base::insert(__x), this); }
  210. #if __cplusplus >= 201103L
  211. iterator
  212. insert(value_type&& __x)
  213. { return { _Base::insert(std::move(__x)), this }; }
  214. #endif
  215. iterator
  216. insert(const_iterator __position, const value_type& __x)
  217. {
  218. __glibcxx_check_insert(__position);
  219. return iterator(_Base::insert(__position.base(), __x), this);
  220. }
  221. #if __cplusplus >= 201103L
  222. iterator
  223. insert(const_iterator __position, value_type&& __x)
  224. {
  225. __glibcxx_check_insert(__position);
  226. return { _Base::insert(__position.base(), std::move(__x)), this };
  227. }
  228. #endif
  229. template<typename _InputIterator>
  230. void
  231. insert(_InputIterator __first, _InputIterator __last)
  232. {
  233. typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
  234. __glibcxx_check_valid_range2(__first, __last, __dist);
  235. if (__dist.second >= __gnu_debug::__dp_sign)
  236. _Base::insert(__gnu_debug::__unsafe(__first),
  237. __gnu_debug::__unsafe(__last));
  238. else
  239. _Base::insert(__first, __last);
  240. }
  241. #if __cplusplus >= 201103L
  242. void
  243. insert(initializer_list<value_type> __l)
  244. { _Base::insert(__l); }
  245. #endif
  246. #if __cplusplus > 201402L
  247. using node_type = typename _Base::node_type;
  248. node_type
  249. extract(const_iterator __position)
  250. {
  251. __glibcxx_check_erase(__position);
  252. this->_M_invalidate_if(_Equal(__position.base()));
  253. return _Base::extract(__position.base());
  254. }
  255. node_type
  256. extract(const key_type& __key)
  257. {
  258. const auto __position = find(__key);
  259. if (__position != end())
  260. return extract(__position);
  261. return {};
  262. }
  263. iterator
  264. insert(node_type&& __nh)
  265. { return { _Base::insert(std::move(__nh)), this }; }
  266. iterator
  267. insert(const_iterator __hint, node_type&& __nh)
  268. {
  269. __glibcxx_check_insert(__hint);
  270. return { _Base::insert(__hint.base(), std::move(__nh)), this };
  271. }
  272. using _Base::merge;
  273. #endif // C++17
  274. #if __cplusplus >= 201103L
  275. _GLIBCXX_ABI_TAG_CXX11
  276. iterator
  277. erase(const_iterator __position)
  278. {
  279. __glibcxx_check_erase(__position);
  280. this->_M_invalidate_if(_Equal(__position.base()));
  281. return { _Base::erase(__position.base()), this };
  282. }
  283. #else
  284. void
  285. erase(iterator __position)
  286. {
  287. __glibcxx_check_erase(__position);
  288. this->_M_invalidate_if(_Equal(__position.base()));
  289. _Base::erase(__position.base());
  290. }
  291. #endif
  292. size_type
  293. erase(const key_type& __x)
  294. {
  295. std::pair<_Base_iterator, _Base_iterator> __victims =
  296. _Base::equal_range(__x);
  297. size_type __count = 0;
  298. _Base_iterator __victim = __victims.first;
  299. while (__victim != __victims.second)
  300. {
  301. this->_M_invalidate_if(_Equal(__victim));
  302. _Base::erase(__victim++);
  303. ++__count;
  304. }
  305. return __count;
  306. }
  307. #if __cplusplus >= 201103L
  308. _GLIBCXX_ABI_TAG_CXX11
  309. iterator
  310. erase(const_iterator __first, const_iterator __last)
  311. {
  312. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  313. // 151. can't currently clear() empty container
  314. __glibcxx_check_erase_range(__first, __last);
  315. for (_Base_const_iterator __victim = __first.base();
  316. __victim != __last.base(); ++__victim)
  317. {
  318. _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(),
  319. _M_message(__gnu_debug::__msg_valid_range)
  320. ._M_iterator(__first, "first")
  321. ._M_iterator(__last, "last"));
  322. this->_M_invalidate_if(_Equal(__victim));
  323. }
  324. return { _Base::erase(__first.base(), __last.base()), this };
  325. }
  326. #else
  327. void
  328. erase(iterator __first, iterator __last)
  329. {
  330. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  331. // 151. can't currently clear() empty container
  332. __glibcxx_check_erase_range(__first, __last);
  333. for (_Base_iterator __victim = __first.base();
  334. __victim != __last.base(); ++__victim)
  335. {
  336. _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(),
  337. _M_message(__gnu_debug::__msg_valid_range)
  338. ._M_iterator(__first, "first")
  339. ._M_iterator(__last, "last"));
  340. this->_M_invalidate_if(_Equal(__victim));
  341. }
  342. _Base::erase(__first.base(), __last.base());
  343. }
  344. #endif
  345. void
  346. swap(multiset& __x)
  347. _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
  348. {
  349. _Safe::_M_swap(__x);
  350. _Base::swap(__x);
  351. }
  352. void
  353. clear() _GLIBCXX_NOEXCEPT
  354. {
  355. this->_M_invalidate_all();
  356. _Base::clear();
  357. }
  358. // observers:
  359. using _Base::key_comp;
  360. using _Base::value_comp;
  361. // multiset operations:
  362. iterator
  363. find(const key_type& __x)
  364. { return iterator(_Base::find(__x), this); }
  365. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  366. // 214. set::find() missing const overload
  367. const_iterator
  368. find(const key_type& __x) const
  369. { return const_iterator(_Base::find(__x), this); }
  370. #if __cplusplus > 201103L
  371. template<typename _Kt,
  372. typename _Req =
  373. typename __has_is_transparent<_Compare, _Kt>::type>
  374. iterator
  375. find(const _Kt& __x)
  376. { return { _Base::find(__x), this }; }
  377. template<typename _Kt,
  378. typename _Req =
  379. typename __has_is_transparent<_Compare, _Kt>::type>
  380. const_iterator
  381. find(const _Kt& __x) const
  382. { return { _Base::find(__x), this }; }
  383. #endif
  384. using _Base::count;
  385. iterator
  386. lower_bound(const key_type& __x)
  387. { return iterator(_Base::lower_bound(__x), this); }
  388. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  389. // 214. set::find() missing const overload
  390. const_iterator
  391. lower_bound(const key_type& __x) const
  392. { return const_iterator(_Base::lower_bound(__x), this); }
  393. #if __cplusplus > 201103L
  394. template<typename _Kt,
  395. typename _Req =
  396. typename __has_is_transparent<_Compare, _Kt>::type>
  397. iterator
  398. lower_bound(const _Kt& __x)
  399. { return { _Base::lower_bound(__x), this }; }
  400. template<typename _Kt,
  401. typename _Req =
  402. typename __has_is_transparent<_Compare, _Kt>::type>
  403. const_iterator
  404. lower_bound(const _Kt& __x) const
  405. { return { _Base::lower_bound(__x), this }; }
  406. #endif
  407. iterator
  408. upper_bound(const key_type& __x)
  409. { return iterator(_Base::upper_bound(__x), this); }
  410. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  411. // 214. set::find() missing const overload
  412. const_iterator
  413. upper_bound(const key_type& __x) const
  414. { return const_iterator(_Base::upper_bound(__x), this); }
  415. #if __cplusplus > 201103L
  416. template<typename _Kt,
  417. typename _Req =
  418. typename __has_is_transparent<_Compare, _Kt>::type>
  419. iterator
  420. upper_bound(const _Kt& __x)
  421. { return { _Base::upper_bound(__x), this }; }
  422. template<typename _Kt,
  423. typename _Req =
  424. typename __has_is_transparent<_Compare, _Kt>::type>
  425. const_iterator
  426. upper_bound(const _Kt& __x) const
  427. { return { _Base::upper_bound(__x), this }; }
  428. #endif
  429. std::pair<iterator,iterator>
  430. equal_range(const key_type& __x)
  431. {
  432. std::pair<_Base_iterator, _Base_iterator> __res =
  433. _Base::equal_range(__x);
  434. return std::make_pair(iterator(__res.first, this),
  435. iterator(__res.second, this));
  436. }
  437. // _GLIBCXX_RESOLVE_LIB_DEFECTS
  438. // 214. set::find() missing const overload
  439. std::pair<const_iterator,const_iterator>
  440. equal_range(const key_type& __x) const
  441. {
  442. std::pair<_Base_const_iterator, _Base_const_iterator> __res =
  443. _Base::equal_range(__x);
  444. return std::make_pair(const_iterator(__res.first, this),
  445. const_iterator(__res.second, this));
  446. }
  447. #if __cplusplus > 201103L
  448. template<typename _Kt,
  449. typename _Req =
  450. typename __has_is_transparent<_Compare, _Kt>::type>
  451. std::pair<iterator, iterator>
  452. equal_range(const _Kt& __x)
  453. {
  454. auto __res = _Base::equal_range(__x);
  455. return { { __res.first, this }, { __res.second, this } };
  456. }
  457. template<typename _Kt,
  458. typename _Req =
  459. typename __has_is_transparent<_Compare, _Kt>::type>
  460. std::pair<const_iterator, const_iterator>
  461. equal_range(const _Kt& __x) const
  462. {
  463. auto __res = _Base::equal_range(__x);
  464. return { { __res.first, this }, { __res.second, this } };
  465. }
  466. #endif
  467. _Base&
  468. _M_base() _GLIBCXX_NOEXCEPT { return *this; }
  469. const _Base&
  470. _M_base() const _GLIBCXX_NOEXCEPT { return *this; }
  471. };
  472. #if __cpp_deduction_guides >= 201606
  473. template<typename _InputIterator,
  474. typename _Compare =
  475. less<typename iterator_traits<_InputIterator>::value_type>,
  476. typename _Allocator =
  477. allocator<typename iterator_traits<_InputIterator>::value_type>,
  478. typename = _RequireInputIter<_InputIterator>,
  479. typename = _RequireNotAllocator<_Compare>,
  480. typename = _RequireAllocator<_Allocator>>
  481. multiset(_InputIterator, _InputIterator,
  482. _Compare = _Compare(), _Allocator = _Allocator())
  483. -> multiset<typename iterator_traits<_InputIterator>::value_type,
  484. _Compare, _Allocator>;
  485. template<typename _Key,
  486. typename _Compare = less<_Key>,
  487. typename _Allocator = allocator<_Key>,
  488. typename = _RequireNotAllocator<_Compare>,
  489. typename = _RequireAllocator<_Allocator>>
  490. multiset(initializer_list<_Key>,
  491. _Compare = _Compare(), _Allocator = _Allocator())
  492. -> multiset<_Key, _Compare, _Allocator>;
  493. template<typename _InputIterator, typename _Allocator,
  494. typename = _RequireInputIter<_InputIterator>,
  495. typename = _RequireAllocator<_Allocator>>
  496. multiset(_InputIterator, _InputIterator, _Allocator)
  497. -> multiset<typename iterator_traits<_InputIterator>::value_type,
  498. less<typename iterator_traits<_InputIterator>::value_type>,
  499. _Allocator>;
  500. template<typename _Key, typename _Allocator,
  501. typename = _RequireAllocator<_Allocator>>
  502. multiset(initializer_list<_Key>, _Allocator)
  503. -> multiset<_Key, less<_Key>, _Allocator>;
  504. #endif // deduction guides
  505. template<typename _Key, typename _Compare, typename _Allocator>
  506. inline bool
  507. operator==(const multiset<_Key, _Compare, _Allocator>& __lhs,
  508. const multiset<_Key, _Compare, _Allocator>& __rhs)
  509. { return __lhs._M_base() == __rhs._M_base(); }
  510. #if __cpp_lib_three_way_comparison
  511. template<typename _Key, typename _Compare, typename _Alloc>
  512. inline __detail::__synth3way_t<_Key>
  513. operator<=>(const multiset<_Key, _Compare, _Alloc>& __lhs,
  514. const multiset<_Key, _Compare, _Alloc>& __rhs)
  515. { return __lhs._M_base() <=> __rhs._M_base(); }
  516. #else
  517. template<typename _Key, typename _Compare, typename _Allocator>
  518. inline bool
  519. operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs,
  520. const multiset<_Key, _Compare, _Allocator>& __rhs)
  521. { return __lhs._M_base() != __rhs._M_base(); }
  522. template<typename _Key, typename _Compare, typename _Allocator>
  523. inline bool
  524. operator<(const multiset<_Key, _Compare, _Allocator>& __lhs,
  525. const multiset<_Key, _Compare, _Allocator>& __rhs)
  526. { return __lhs._M_base() < __rhs._M_base(); }
  527. template<typename _Key, typename _Compare, typename _Allocator>
  528. inline bool
  529. operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs,
  530. const multiset<_Key, _Compare, _Allocator>& __rhs)
  531. { return __lhs._M_base() <= __rhs._M_base(); }
  532. template<typename _Key, typename _Compare, typename _Allocator>
  533. inline bool
  534. operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs,
  535. const multiset<_Key, _Compare, _Allocator>& __rhs)
  536. { return __lhs._M_base() >= __rhs._M_base(); }
  537. template<typename _Key, typename _Compare, typename _Allocator>
  538. inline bool
  539. operator>(const multiset<_Key, _Compare, _Allocator>& __lhs,
  540. const multiset<_Key, _Compare, _Allocator>& __rhs)
  541. { return __lhs._M_base() > __rhs._M_base(); }
  542. #endif // three-way comparison
  543. template<typename _Key, typename _Compare, typename _Allocator>
  544. void
  545. swap(multiset<_Key, _Compare, _Allocator>& __x,
  546. multiset<_Key, _Compare, _Allocator>& __y)
  547. _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y)))
  548. { return __x.swap(__y); }
  549. } // namespace __debug
  550. } // namespace std
  551. #endif