Skip to content

Commit

Permalink
Switch to boost::core::invoke_swap.
Browse files Browse the repository at this point in the history
boost::swap is deprecated and will be removed. Use boost::core::invoke_swap
as a replacement.
  • Loading branch information
Lastique committed Sep 3, 2023
1 parent d4f8e6b commit f44ada4
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions include/boost/scope/unique_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#define BOOST_SCOPE_UNIQUE_RESOURCE_HPP_INCLUDED_

#include <type_traits>
#include <boost/core/swap.hpp>
#include <boost/core/addressof.hpp>
#include <boost/core/invoke_swap.hpp>
#include <boost/scope/unique_resource_fwd.hpp>
#include <boost/scope/detail/config.hpp>
#include <boost/scope/detail/compact_storage.hpp>
Expand Down Expand Up @@ -615,8 +615,8 @@ class unique_resource_data :

void swap_impl(unique_resource_data& that, std::true_type, std::true_type) noexcept
{
boost::swap(get_internal_resource(), that.get_internal_resource());
boost::swap(get_internal_deleter(), that.get_internal_deleter());
boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource());
boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter());

const bool allocated = m_allocated;
m_allocated = that.m_allocated;
Expand All @@ -625,14 +625,14 @@ class unique_resource_data :

void swap_impl(unique_resource_data& that, std::true_type, std::false_type)
{
boost::swap(get_internal_resource(), that.get_internal_resource());
boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource());
try
{
boost::swap(get_internal_deleter(), that.get_internal_deleter());
boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter());
}
catch (...)
{
boost::swap(get_internal_resource(), that.get_internal_resource());
boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource());
throw;
}

Expand All @@ -643,14 +643,14 @@ class unique_resource_data :

void swap_impl(unique_resource_data& that, std::false_type, std::false_type)
{
boost::swap(get_internal_deleter(), that.get_internal_deleter());
boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter());
try
{
boost::swap(get_internal_resource(), that.get_internal_resource());
boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource());
}
catch (...)
{
boost::swap(get_internal_deleter(), that.get_internal_deleter());
boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter());
throw;
}

Expand Down Expand Up @@ -896,34 +896,34 @@ class unique_resource_data< Resource, Deleter, Traits, true > :

void swap_impl(unique_resource_data& that, std::true_type, std::true_type) noexcept
{
boost::swap(get_internal_resource(), that.get_internal_resource());
boost::swap(get_internal_deleter(), that.get_internal_deleter());
boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource());
boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter());
}

void swap_impl(unique_resource_data& that, std::true_type, std::false_type)
{
boost::swap(get_internal_resource(), that.get_internal_resource());
boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource());
try
{
boost::swap(get_internal_deleter(), that.get_internal_deleter());
boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter());
}
catch (...)
{
boost::swap(get_internal_resource(), that.get_internal_resource());
boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource());
throw;
}
}

void swap_impl(unique_resource_data& that, std::false_type, std::false_type)
{
boost::swap(get_internal_deleter(), that.get_internal_deleter());
boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter());
try
{
boost::swap(get_internal_resource(), that.get_internal_resource());
boost::core::invoke_swap(get_internal_resource(), that.get_internal_resource());
}
catch (...)
{
boost::swap(get_internal_deleter(), that.get_internal_deleter());
boost::core::invoke_swap(get_internal_deleter(), that.get_internal_deleter());
throw;
}
}
Expand Down

0 comments on commit f44ada4

Please sign in to comment.