forked from boostorg/core
The rename allows to avoid forming an infinite recursion in compile time (because of noexcept specification that needs to resolve the unqualified call to swap) or run time (in case if the boost::swap function is the only one suitable for the passed arguments). To avoid the compile-time recursion, removed noexcept specification from boost::swap. The specification is still present in boost::core::invoke_swap. Deprecated boost::swap and associated headers. boost::core::invoke_swap is defined in a new boost/core/invoke_swap.hpp header. Updated docs and tests. Removed tests that check inclusion of deprecated headers. Fixes https://github.com/boostorg/core/issues/148.
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
// Copyright (C) 2007, 2008 Steven Watanabe, Joseph Gauterin, Niels Dekker
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See
|
|
// accompanying file LICENSE_1_0.txt or copy at
|
|
// http://www.boost.org/LICENSE_1_0.txt)
|
|
// For more information, see http://www.boost.org
|
|
|
|
|
|
#ifndef BOOST_CORE_SWAP_HPP
|
|
#define BOOST_CORE_SWAP_HPP
|
|
|
|
// Note: the implementation of this utility contains various workarounds:
|
|
// - boost::swap has two template arguments, instead of one, to
|
|
// avoid ambiguity when swapping objects of a Boost type that does
|
|
// not have its own boost::swap overload.
|
|
|
|
#include <boost/core/enable_if.hpp>
|
|
#include <boost/config.hpp>
|
|
#include <boost/config/header_deprecated.hpp>
|
|
#include <boost/core/invoke_swap.hpp>
|
|
|
|
#ifdef BOOST_HAS_PRAGMA_ONCE
|
|
#pragma once
|
|
#endif
|
|
|
|
BOOST_HEADER_DEPRECATED("boost/core/invoke_swap.hpp")
|
|
|
|
namespace boost
|
|
{
|
|
template<class T1, class T2>
|
|
BOOST_GPU_ENABLED
|
|
BOOST_DEPRECATED("This function is deprecated, use boost::core::invoke_swap instead.")
|
|
inline typename enable_if_c< !boost_swap_impl::is_const<T1>::value && !boost_swap_impl::is_const<T2>::value >::type
|
|
swap(T1& left, T2& right)
|
|
{
|
|
boost::core::invoke_swap(left, right);
|
|
}
|
|
}
|
|
|
|
#endif // BOOST_CORE_SWAP_HPP
|