]>
Commit | Line | Data |
---|---|---|
285b36d6 BK |
1 | // Debugging vector implementation -*- C++ -*- |
2 | ||
36d6d979 | 3 | // Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 |
285b36d6 BK |
4 | // Free Software Foundation, Inc. |
5 | // | |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
9 | // Free Software Foundation; either version 2, or (at your option) | |
10 | // any later version. | |
11 | ||
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | ||
17 | // You should have received a copy of the GNU General Public License along | |
18 | // with this library; see the file COPYING. If not, write to the Free | |
83f51799 | 19 | // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
285b36d6 BK |
20 | // USA. |
21 | ||
22 | // As a special exception, you may use this file as part of a free software | |
23 | // library without restriction. Specifically, if other files instantiate | |
24 | // templates or use macros or inline functions from this file, or you compile | |
25 | // this file and link it with other files to produce an executable, this | |
26 | // file does not by itself cause the resulting executable to be covered by | |
27 | // the GNU General Public License. This exception does not however | |
28 | // invalidate any other reasons why the executable file might be covered by | |
29 | // the GNU General Public License. | |
30 | ||
78a53887 BK |
31 | /** @file debug/vector |
32 | * This file is a GNU debug extension to the Standard C++ Library. | |
33 | */ | |
34 | ||
285b36d6 BK |
35 | #ifndef _GLIBCXX_DEBUG_VECTOR |
36 | #define _GLIBCXX_DEBUG_VECTOR 1 | |
37 | ||
38 | #include <vector> | |
d2763ab5 | 39 | #include <utility> |
285b36d6 BK |
40 | #include <debug/safe_sequence.h> |
41 | #include <debug/safe_iterator.h> | |
42 | ||
3cbc7af0 BK |
43 | namespace std |
44 | { | |
45f388bb | 45 | namespace __debug |
285b36d6 | 46 | { |
526da49c | 47 | template<typename _Tp, |
285b36d6 BK |
48 | typename _Allocator = std::allocator<_Tp> > |
49 | class vector | |
c2ba9709 | 50 | : public _GLIBCXX_STD_D::vector<_Tp, _Allocator>, |
285b36d6 BK |
51 | public __gnu_debug::_Safe_sequence<vector<_Tp, _Allocator> > |
52 | { | |
c2ba9709 | 53 | typedef _GLIBCXX_STD_D::vector<_Tp, _Allocator> _Base; |
285b36d6 BK |
54 | typedef __gnu_debug::_Safe_sequence<vector> _Safe_base; |
55 | ||
56 | typedef typename _Base::const_iterator _Base_const_iterator; | |
57 | typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; | |
58 | ||
59 | public: | |
60 | typedef typename _Base::reference reference; | |
61 | typedef typename _Base::const_reference const_reference; | |
62 | ||
526da49c | 63 | typedef __gnu_debug::_Safe_iterator<typename _Base::iterator,vector> |
285b36d6 BK |
64 | iterator; |
65 | typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator,vector> | |
66 | const_iterator; | |
67 | ||
68 | typedef typename _Base::size_type size_type; | |
69 | typedef typename _Base::difference_type difference_type; | |
70 | ||
526da49c BI |
71 | typedef _Tp value_type; |
72 | typedef _Allocator allocator_type; | |
09952acc PC |
73 | typedef typename _Base::pointer pointer; |
74 | typedef typename _Base::const_pointer const_pointer; | |
285b36d6 BK |
75 | typedef std::reverse_iterator<iterator> reverse_iterator; |
76 | typedef std::reverse_iterator<const_iterator> const_reverse_iterator; | |
77 | ||
78 | // 23.2.4.1 construct/copy/destroy: | |
79 | explicit vector(const _Allocator& __a = _Allocator()) | |
80 | : _Base(__a), _M_guaranteed_capacity(0) { } | |
81 | ||
82 | explicit vector(size_type __n, const _Tp& __value = _Tp(), | |
83 | const _Allocator& __a = _Allocator()) | |
84 | : _Base(__n, __value, __a), _M_guaranteed_capacity(__n) { } | |
85 | ||
86 | template<class _InputIterator> | |
87 | vector(_InputIterator __first, _InputIterator __last, | |
88 | const _Allocator& __a = _Allocator()) | |
526da49c | 89 | : _Base(__gnu_debug::__check_valid_range(__first, __last), |
285b36d6 BK |
90 | __last, __a), |
91 | _M_guaranteed_capacity(0) | |
92 | { _M_update_guaranteed_capacity(); } | |
93 | ||
ed540c0a | 94 | vector(const vector& __x) |
285b36d6 BK |
95 | : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { } |
96 | ||
97 | /// Construction from a release-mode vector | |
526da49c | 98 | vector(const _Base& __x) |
285b36d6 BK |
99 | : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { } |
100 | ||
ed540c0a CJ |
101 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ |
102 | vector(vector&& __x) | |
cc8c030d PC |
103 | : _Base(std::forward<vector>(__x)), _Safe_base(), |
104 | _M_guaranteed_capacity(this->size()) | |
105 | { | |
ed540c0a CJ |
106 | this->_M_swap(__x); |
107 | __x._M_guaranteed_capacity = 0; | |
108 | } | |
988499f4 JM |
109 | |
110 | vector(initializer_list<value_type> __l, | |
111 | const allocator_type& __a = allocator_type()) | |
112 | : _Base(__l, __a), _Safe_base(), | |
113 | _M_guaranteed_capacity(__l.size()) { } | |
ed540c0a CJ |
114 | #endif |
115 | ||
285b36d6 BK |
116 | ~vector() { } |
117 | ||
ed540c0a CJ |
118 | vector& |
119 | operator=(const vector& __x) | |
285b36d6 BK |
120 | { |
121 | static_cast<_Base&>(*this) = __x; | |
122 | this->_M_invalidate_all(); | |
123 | _M_update_guaranteed_capacity(); | |
124 | return *this; | |
125 | } | |
126 | ||
ed540c0a CJ |
127 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ |
128 | vector& | |
129 | operator=(vector&& __x) | |
130 | { | |
cbc6c888 PC |
131 | // NB: DR 675. |
132 | clear(); | |
ed540c0a CJ |
133 | swap(__x); |
134 | return *this; | |
135 | } | |
988499f4 JM |
136 | |
137 | vector& | |
138 | operator=(initializer_list<value_type> __l) | |
139 | { | |
140 | static_cast<_Base&>(*this) = __l; | |
141 | this->_M_invalidate_all(); | |
142 | _M_update_guaranteed_capacity(); | |
143 | return *this; | |
144 | } | |
ed540c0a CJ |
145 | #endif |
146 | ||
285b36d6 | 147 | template<typename _InputIterator> |
526da49c | 148 | void |
285b36d6 BK |
149 | assign(_InputIterator __first, _InputIterator __last) |
150 | { | |
151 | __glibcxx_check_valid_range(__first, __last); | |
152 | _Base::assign(__first, __last); | |
153 | this->_M_invalidate_all(); | |
154 | _M_update_guaranteed_capacity(); | |
155 | } | |
156 | ||
526da49c | 157 | void |
285b36d6 BK |
158 | assign(size_type __n, const _Tp& __u) |
159 | { | |
160 | _Base::assign(__n, __u); | |
161 | this->_M_invalidate_all(); | |
162 | _M_update_guaranteed_capacity(); | |
163 | } | |
164 | ||
988499f4 JM |
165 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ |
166 | void | |
167 | assign(initializer_list<value_type> __l) | |
168 | { | |
169 | _Base::assign(__l); | |
170 | this->_M_invalidate_all(); | |
171 | _M_update_guaranteed_capacity(); | |
172 | } | |
173 | #endif | |
174 | ||
285b36d6 BK |
175 | using _Base::get_allocator; |
176 | ||
177 | // iterators: | |
526da49c BI |
178 | iterator |
179 | begin() | |
285b36d6 BK |
180 | { return iterator(_Base::begin(), this); } |
181 | ||
526da49c BI |
182 | const_iterator |
183 | begin() const | |
285b36d6 BK |
184 | { return const_iterator(_Base::begin(), this); } |
185 | ||
526da49c | 186 | iterator |
285b36d6 BK |
187 | end() |
188 | { return iterator(_Base::end(), this); } | |
189 | ||
526da49c | 190 | const_iterator |
285b36d6 BK |
191 | end() const |
192 | { return const_iterator(_Base::end(), this); } | |
193 | ||
526da49c BI |
194 | reverse_iterator |
195 | rbegin() | |
285b36d6 BK |
196 | { return reverse_iterator(end()); } |
197 | ||
526da49c | 198 | const_reverse_iterator |
285b36d6 BK |
199 | rbegin() const |
200 | { return const_reverse_iterator(end()); } | |
201 | ||
526da49c BI |
202 | reverse_iterator |
203 | rend() | |
285b36d6 BK |
204 | { return reverse_iterator(begin()); } |
205 | ||
526da49c BI |
206 | const_reverse_iterator |
207 | rend() const | |
285b36d6 BK |
208 | { return const_reverse_iterator(begin()); } |
209 | ||
0cd50f89 PC |
210 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ |
211 | const_iterator | |
212 | cbegin() const | |
213 | { return const_iterator(_Base::begin(), this); } | |
214 | ||
215 | const_iterator | |
216 | cend() const | |
217 | { return const_iterator(_Base::end(), this); } | |
218 | ||
219 | const_reverse_iterator | |
220 | crbegin() const | |
221 | { return const_reverse_iterator(end()); } | |
222 | ||
223 | const_reverse_iterator | |
224 | crend() const | |
225 | { return const_reverse_iterator(begin()); } | |
226 | #endif | |
227 | ||
285b36d6 BK |
228 | // 23.2.4.2 capacity: |
229 | using _Base::size; | |
230 | using _Base::max_size; | |
231 | ||
526da49c | 232 | void |
285b36d6 BK |
233 | resize(size_type __sz, _Tp __c = _Tp()) |
234 | { | |
235 | bool __realloc = _M_requires_reallocation(__sz); | |
236 | if (__sz < this->size()) | |
237 | this->_M_invalidate_if(_After_nth(__sz, _M_base().begin())); | |
238 | _Base::resize(__sz, __c); | |
239 | if (__realloc) | |
240 | this->_M_invalidate_all(); | |
241 | } | |
242 | ||
2028b66d SS |
243 | size_type |
244 | capacity() const | |
245 | { | |
246 | #ifdef _GLIBCXX_DEBUG_PEDANTIC | |
247 | return _M_guaranteed_capacity; | |
248 | #else | |
249 | return _Base::capacity(); | |
250 | #endif | |
251 | } | |
252 | ||
285b36d6 BK |
253 | using _Base::empty; |
254 | ||
526da49c | 255 | void |
285b36d6 BK |
256 | reserve(size_type __n) |
257 | { | |
258 | bool __realloc = _M_requires_reallocation(__n); | |
259 | _Base::reserve(__n); | |
260 | if (__n > _M_guaranteed_capacity) | |
261 | _M_guaranteed_capacity = __n; | |
262 | if (__realloc) | |
263 | this->_M_invalidate_all(); | |
264 | } | |
265 | ||
266 | // element access: | |
526da49c | 267 | reference |
285b36d6 BK |
268 | operator[](size_type __n) |
269 | { | |
270 | __glibcxx_check_subscript(__n); | |
271 | return _M_base()[__n]; | |
272 | } | |
273 | ||
526da49c | 274 | const_reference |
285b36d6 BK |
275 | operator[](size_type __n) const |
276 | { | |
277 | __glibcxx_check_subscript(__n); | |
278 | return _M_base()[__n]; | |
279 | } | |
280 | ||
281 | using _Base::at; | |
282 | ||
526da49c | 283 | reference |
285b36d6 BK |
284 | front() |
285 | { | |
286 | __glibcxx_check_nonempty(); | |
287 | return _Base::front(); | |
288 | } | |
289 | ||
526da49c | 290 | const_reference |
285b36d6 BK |
291 | front() const |
292 | { | |
293 | __glibcxx_check_nonempty(); | |
294 | return _Base::front(); | |
295 | } | |
296 | ||
526da49c | 297 | reference |
285b36d6 BK |
298 | back() |
299 | { | |
300 | __glibcxx_check_nonempty(); | |
301 | return _Base::back(); | |
302 | } | |
303 | ||
526da49c | 304 | const_reference |
285b36d6 BK |
305 | back() const |
306 | { | |
307 | __glibcxx_check_nonempty(); | |
308 | return _Base::back(); | |
309 | } | |
310 | ||
8b5f07a2 PC |
311 | // _GLIBCXX_RESOLVE_LIB_DEFECTS |
312 | // DR 464. Suggestion for new member functions in standard containers. | |
313 | using _Base::data; | |
314 | ||
285b36d6 | 315 | // 23.2.4.3 modifiers: |
526da49c | 316 | void |
285b36d6 BK |
317 | push_back(const _Tp& __x) |
318 | { | |
319 | bool __realloc = _M_requires_reallocation(this->size() + 1); | |
320 | _Base::push_back(__x); | |
321 | if (__realloc) | |
322 | this->_M_invalidate_all(); | |
323 | _M_update_guaranteed_capacity(); | |
324 | } | |
4dc3e453 PC |
325 | |
326 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ | |
77f376d9 PC |
327 | template<typename _Up = _Tp> |
328 | typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value, | |
329 | void>::__type | |
330 | push_back(_Tp&& __x) | |
331 | { emplace_back(std::move(__x)); } | |
4dc3e453 | 332 | |
6eef7402 CJ |
333 | template<typename... _Args> |
334 | void | |
4dc3e453 | 335 | emplace_back(_Args&&... __args) |
6eef7402 CJ |
336 | { |
337 | bool __realloc = _M_requires_reallocation(this->size() + 1); | |
4dc3e453 | 338 | _Base::emplace_back(std::forward<_Args>(__args)...); |
6eef7402 CJ |
339 | if (__realloc) |
340 | this->_M_invalidate_all(); | |
341 | _M_update_guaranteed_capacity(); | |
342 | } | |
343 | #endif | |
285b36d6 | 344 | |
526da49c | 345 | void |
285b36d6 BK |
346 | pop_back() |
347 | { | |
348 | __glibcxx_check_nonempty(); | |
349 | iterator __victim = end() - 1; | |
350 | __victim._M_invalidate(); | |
351 | _Base::pop_back(); | |
352 | } | |
353 | ||
6eef7402 CJ |
354 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ |
355 | template<typename... _Args> | |
356 | iterator | |
0a485bae | 357 | emplace(iterator __position, _Args&&... __args) |
6eef7402 CJ |
358 | { |
359 | __glibcxx_check_insert(__position); | |
360 | bool __realloc = _M_requires_reallocation(this->size() + 1); | |
361 | difference_type __offset = __position - begin(); | |
362 | typename _Base::iterator __res = _Base::emplace(__position.base(), | |
363 | std::forward<_Args>(__args)...); | |
364 | if (__realloc) | |
365 | this->_M_invalidate_all(); | |
366 | else | |
367 | this->_M_invalidate_if(_After_nth(__offset, _M_base().begin())); | |
368 | _M_update_guaranteed_capacity(); | |
369 | return iterator(__res, this); | |
370 | } | |
371 | #endif | |
372 | ||
526da49c | 373 | iterator |
285b36d6 BK |
374 | insert(iterator __position, const _Tp& __x) |
375 | { | |
376 | __glibcxx_check_insert(__position); | |
377 | bool __realloc = _M_requires_reallocation(this->size() + 1); | |
378 | difference_type __offset = __position - begin(); | |
379 | typename _Base::iterator __res = _Base::insert(__position.base(),__x); | |
380 | if (__realloc) | |
381 | this->_M_invalidate_all(); | |
382 | else | |
383 | this->_M_invalidate_if(_After_nth(__offset, _M_base().begin())); | |
384 | _M_update_guaranteed_capacity(); | |
385 | return iterator(__res, this); | |
386 | } | |
387 | ||
6eef7402 | 388 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ |
77f376d9 PC |
389 | template<typename _Up = _Tp> |
390 | typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value, | |
391 | iterator>::__type | |
392 | insert(iterator __position, _Tp&& __x) | |
393 | { return emplace(__position, std::move(__x)); } | |
988499f4 JM |
394 | |
395 | void | |
396 | insert(iterator __position, initializer_list<value_type> __l) | |
397 | { this->insert(__position, __l.begin(), __l.end()); } | |
6eef7402 CJ |
398 | #endif |
399 | ||
526da49c | 400 | void |
285b36d6 BK |
401 | insert(iterator __position, size_type __n, const _Tp& __x) |
402 | { | |
403 | __glibcxx_check_insert(__position); | |
404 | bool __realloc = _M_requires_reallocation(this->size() + __n); | |
405 | difference_type __offset = __position - begin(); | |
406 | _Base::insert(__position.base(), __n, __x); | |
407 | if (__realloc) | |
408 | this->_M_invalidate_all(); | |
409 | else | |
410 | this->_M_invalidate_if(_After_nth(__offset, _M_base().begin())); | |
411 | _M_update_guaranteed_capacity(); | |
412 | } | |
413 | ||
414 | template<class _InputIterator> | |
526da49c BI |
415 | void |
416 | insert(iterator __position, | |
285b36d6 BK |
417 | _InputIterator __first, _InputIterator __last) |
418 | { | |
419 | __glibcxx_check_insert_range(__position, __first, __last); | |
526da49c | 420 | |
285b36d6 BK |
421 | /* Hard to guess if invalidation will occur, because __last |
422 | - __first can't be calculated in all cases, so we just | |
423 | punt here by checking if it did occur. */ | |
424 | typename _Base::iterator __old_begin = _M_base().begin(); | |
425 | difference_type __offset = __position - begin(); | |
426 | _Base::insert(__position.base(), __first, __last); | |
526da49c | 427 | |
285b36d6 BK |
428 | if (_M_base().begin() != __old_begin) |
429 | this->_M_invalidate_all(); | |
430 | else | |
431 | this->_M_invalidate_if(_After_nth(__offset, _M_base().begin())); | |
432 | _M_update_guaranteed_capacity(); | |
433 | } | |
526da49c BI |
434 | |
435 | iterator | |
285b36d6 BK |
436 | erase(iterator __position) |
437 | { | |
438 | __glibcxx_check_erase(__position); | |
439 | difference_type __offset = __position - begin(); | |
440 | typename _Base::iterator __res = _Base::erase(__position.base()); | |
441 | this->_M_invalidate_if(_After_nth(__offset, _M_base().begin())); | |
442 | return iterator(__res, this); | |
443 | } | |
444 | ||
526da49c | 445 | iterator |
285b36d6 BK |
446 | erase(iterator __first, iterator __last) |
447 | { | |
448 | // _GLIBCXX_RESOLVE_LIB_DEFECTS | |
449 | // 151. can't currently clear() empty container | |
450 | __glibcxx_check_erase_range(__first, __last); | |
526da49c | 451 | |
285b36d6 | 452 | difference_type __offset = __first - begin(); |
526da49c | 453 | typename _Base::iterator __res = _Base::erase(__first.base(), |
285b36d6 BK |
454 | __last.base()); |
455 | this->_M_invalidate_if(_After_nth(__offset, _M_base().begin())); | |
456 | return iterator(__res, this); | |
457 | } | |
458 | ||
526da49c | 459 | void |
ed540c0a CJ |
460 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ |
461 | swap(vector&& __x) | |
462 | #else | |
463 | swap(vector& __x) | |
464 | #endif | |
285b36d6 BK |
465 | { |
466 | _Base::swap(__x); | |
467 | this->_M_swap(__x); | |
1b80d64a | 468 | std::swap(_M_guaranteed_capacity, __x._M_guaranteed_capacity); |
285b36d6 BK |
469 | } |
470 | ||
526da49c | 471 | void |
285b36d6 BK |
472 | clear() |
473 | { | |
474 | _Base::clear(); | |
475 | this->_M_invalidate_all(); | |
1b80d64a | 476 | _M_guaranteed_capacity = 0; |
285b36d6 BK |
477 | } |
478 | ||
526da49c | 479 | _Base& |
285b36d6 BK |
480 | _M_base() { return *this; } |
481 | ||
526da49c | 482 | const _Base& |
285b36d6 BK |
483 | _M_base() const { return *this; } |
484 | ||
485 | private: | |
486 | size_type _M_guaranteed_capacity; | |
487 | ||
526da49c | 488 | bool |
285b36d6 | 489 | _M_requires_reallocation(size_type __elements) |
2028b66d | 490 | { return __elements > this->capacity(); } |
526da49c BI |
491 | |
492 | void | |
285b36d6 BK |
493 | _M_update_guaranteed_capacity() |
494 | { | |
495 | if (this->size() > _M_guaranteed_capacity) | |
496 | _M_guaranteed_capacity = this->size(); | |
497 | } | |
498 | }; | |
499 | ||
500 | template<typename _Tp, typename _Alloc> | |
501 | inline bool | |
502 | operator==(const vector<_Tp, _Alloc>& __lhs, | |
503 | const vector<_Tp, _Alloc>& __rhs) | |
504 | { return __lhs._M_base() == __rhs._M_base(); } | |
505 | ||
506 | template<typename _Tp, typename _Alloc> | |
507 | inline bool | |
526da49c | 508 | operator!=(const vector<_Tp, _Alloc>& __lhs, |
285b36d6 BK |
509 | const vector<_Tp, _Alloc>& __rhs) |
510 | { return __lhs._M_base() != __rhs._M_base(); } | |
511 | ||
512 | template<typename _Tp, typename _Alloc> | |
513 | inline bool | |
526da49c | 514 | operator<(const vector<_Tp, _Alloc>& __lhs, |
285b36d6 BK |
515 | const vector<_Tp, _Alloc>& __rhs) |
516 | { return __lhs._M_base() < __rhs._M_base(); } | |
517 | ||
518 | template<typename _Tp, typename _Alloc> | |
519 | inline bool | |
526da49c | 520 | operator<=(const vector<_Tp, _Alloc>& __lhs, |
285b36d6 BK |
521 | const vector<_Tp, _Alloc>& __rhs) |
522 | { return __lhs._M_base() <= __rhs._M_base(); } | |
523 | ||
524 | template<typename _Tp, typename _Alloc> | |
525 | inline bool | |
526da49c | 526 | operator>=(const vector<_Tp, _Alloc>& __lhs, |
285b36d6 BK |
527 | const vector<_Tp, _Alloc>& __rhs) |
528 | { return __lhs._M_base() >= __rhs._M_base(); } | |
529 | ||
530 | template<typename _Tp, typename _Alloc> | |
531 | inline bool | |
526da49c | 532 | operator>(const vector<_Tp, _Alloc>& __lhs, |
285b36d6 BK |
533 | const vector<_Tp, _Alloc>& __rhs) |
534 | { return __lhs._M_base() > __rhs._M_base(); } | |
535 | ||
536 | template<typename _Tp, typename _Alloc> | |
537 | inline void | |
538 | swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs) | |
539 | { __lhs.swap(__rhs); } | |
ed540c0a CJ |
540 | |
541 | #ifdef __GXX_EXPERIMENTAL_CXX0X__ | |
542 | template<typename _Tp, typename _Alloc> | |
543 | inline void | |
544 | swap(vector<_Tp, _Alloc>&& __lhs, vector<_Tp, _Alloc>& __rhs) | |
545 | { __lhs.swap(__rhs); } | |
546 | ||
547 | template<typename _Tp, typename _Alloc> | |
548 | inline void | |
549 | swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>&& __rhs) | |
550 | { __lhs.swap(__rhs); } | |
551 | #endif | |
552 | ||
45f388bb | 553 | } // namespace __debug |
3cbc7af0 | 554 | } // namespace std |
285b36d6 | 555 | |
526da49c | 556 | #endif |