Remove use of core/invoke_swap

This commit is contained in:
Peter Dimov
2025-01-26 04:08:06 +02:00
parent 435b293467
commit 55bc631d40

View File

@ -43,12 +43,12 @@
#endif #endif
#include <boost/assert.hpp> #include <boost/assert.hpp>
#include <boost/core/invoke_swap.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
#include <stdexcept> #include <stdexcept>
#include <utility>
#include <cstddef> #include <cstddef>
namespace boost { namespace boost {
@ -143,9 +143,9 @@ namespace boost {
enum { static_size = N }; enum { static_size = N };
// swap (note: linear complexity) // swap (note: linear complexity)
BOOST_CXX14_CONSTEXPR void swap (array<T,N>& y) { BOOST_CXX14_CONSTEXPR void swap (array<T,N>& y)
for (size_type i = 0; i < N; ++i) {
boost::core::invoke_swap(elems[i],y.elems[i]); std::swap( elems, y.elems );
} }
// direct access to data // direct access to data
@ -264,7 +264,8 @@ namespace boost {
static BOOST_CONSTEXPR size_type max_size() BOOST_NOEXCEPT { return 0; } static BOOST_CONSTEXPR size_type max_size() BOOST_NOEXCEPT { return 0; }
enum { static_size = 0 }; enum { static_size = 0 };
void swap (array<T,0>& /*y*/) { BOOST_CXX14_CONSTEXPR void swap (array<T,0>& /*y*/)
{
} }
// direct access to data // direct access to data
@ -370,7 +371,7 @@ namespace boost {
// global swap() // global swap()
template<class T, std::size_t N> template<class T, std::size_t N>
inline void swap (array<T,N>& x, array<T,N>& y) { BOOST_CXX14_CONSTEXPR inline void swap (array<T,N>& x, array<T,N>& y) {
x.swap(y); x.swap(y);
} }