You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

679 lines
20KB

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