multiset.h 19 KB

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