mirror of
https://github.com/boostorg/utility.git
synced 2025-05-09 15:04:00 +00:00
Switch to boost::core::invoke_swap.
boost::swap is deprecated and will be removed. Use boost::core::invoke_swap as a replacement.
This commit is contained in:
parent
eb721609af
commit
52e3e64a34
@ -23,7 +23,7 @@
|
|||||||
// contains. More details on these issues are at libs/utility/value_init.htm
|
// contains. More details on these issues are at libs/utility/value_init.htm
|
||||||
|
|
||||||
#include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION.
|
#include <boost/config.hpp> // For BOOST_NO_COMPLETE_VALUE_INITIALIZATION.
|
||||||
#include <boost/core/swap.hpp>
|
#include <boost/core/invoke_swap.hpp>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ class initialized
|
|||||||
BOOST_GPU_ENABLED
|
BOOST_GPU_ENABLED
|
||||||
void swap(initialized & arg)
|
void swap(initialized & arg)
|
||||||
{
|
{
|
||||||
::boost::swap( this->data(), arg.data() );
|
::boost::core::invoke_swap( this->data(), arg.data() );
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_GPU_ENABLED
|
BOOST_GPU_ENABLED
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <boost/core/invoke_swap.hpp>
|
||||||
#include <boost/core/lightweight_test.hpp>
|
#include <boost/core/lightweight_test.hpp>
|
||||||
#include <boost/config/workaround.hpp>
|
#include <boost/config/workaround.hpp>
|
||||||
|
|
||||||
@ -360,7 +361,7 @@ int main()
|
|||||||
boost::value_initialized<SwapFunctionCallTester> swapFunctionCallTester2;
|
boost::value_initialized<SwapFunctionCallTester> swapFunctionCallTester2;
|
||||||
get(swapFunctionCallTester1).data = 1;
|
get(swapFunctionCallTester1).data = 1;
|
||||||
get(swapFunctionCallTester2).data = 2;
|
get(swapFunctionCallTester2).data = 2;
|
||||||
boost::swap(swapFunctionCallTester1, swapFunctionCallTester2);
|
boost::core::invoke_swap(swapFunctionCallTester1, swapFunctionCallTester2);
|
||||||
BOOST_TEST( get(swapFunctionCallTester1).data == 2 );
|
BOOST_TEST( get(swapFunctionCallTester1).data == 2 );
|
||||||
BOOST_TEST( get(swapFunctionCallTester2).data == 1 );
|
BOOST_TEST( get(swapFunctionCallTester2).data == 1 );
|
||||||
BOOST_TEST( get(swapFunctionCallTester1).is_custom_swap_called );
|
BOOST_TEST( get(swapFunctionCallTester1).is_custom_swap_called );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user