|
43 | 43 | #endif |
44 | 44 |
|
45 | 45 | #include <boost/assert.hpp> |
46 | | -#include <boost/core/invoke_swap.hpp> |
47 | 46 | #include <boost/static_assert.hpp> |
48 | 47 | #include <boost/throw_exception.hpp> |
49 | 48 | #include <algorithm> |
50 | 49 | #include <iterator> |
51 | 50 | #include <stdexcept> |
| 51 | +#include <utility> |
52 | 52 | #include <cstddef> |
53 | 53 |
|
54 | 54 | namespace boost { |
@@ -143,9 +143,9 @@ namespace boost { |
143 | 143 | enum { static_size = N }; |
144 | 144 |
|
145 | 145 | // swap (note: linear complexity) |
146 | | - BOOST_CXX14_CONSTEXPR void swap (array<T,N>& y) { |
147 | | - for (size_type i = 0; i < N; ++i) |
148 | | - boost::core::invoke_swap(elems[i],y.elems[i]); |
| 146 | + BOOST_CXX14_CONSTEXPR void swap (array<T,N>& y) |
| 147 | + { |
| 148 | + std::swap( elems, y.elems ); |
149 | 149 | } |
150 | 150 |
|
151 | 151 | // direct access to data |
@@ -264,7 +264,8 @@ namespace boost { |
264 | 264 | static BOOST_CONSTEXPR size_type max_size() BOOST_NOEXCEPT { return 0; } |
265 | 265 | enum { static_size = 0 }; |
266 | 266 |
|
267 | | - void swap (array<T,0>& /*y*/) { |
| 267 | + BOOST_CXX14_CONSTEXPR void swap (array<T,0>& /*y*/) |
| 268 | + { |
268 | 269 | } |
269 | 270 |
|
270 | 271 | // direct access to data |
@@ -370,7 +371,7 @@ namespace boost { |
370 | 371 |
|
371 | 372 | // global swap() |
372 | 373 | template<class T, std::size_t N> |
373 | | - inline void swap (array<T,N>& x, array<T,N>& y) { |
| 374 | + BOOST_CXX14_CONSTEXPR inline void swap (array<T,N>& x, array<T,N>& y) { |
374 | 375 | x.swap(y); |
375 | 376 | } |
376 | 377 |
|
|
0 commit comments