Skip to content

Commit

Permalink
Made unique_resource::reset() implementation slightly more efficient.
Browse files Browse the repository at this point in the history
  • Loading branch information
Lastique committed Jan 28, 2024
1 parent 7be5037 commit 6f2adf3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/boost/scope/unique_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ class unique_resource
{
reset_impl
(
static_cast< typename detail::move_or_copy_assign_ref< R, resource_type >::type >(res),
static_cast< R&& >(res),
typename detail::conjunction<
detail::is_nothrow_invocable< deleter_type&, resource_type& >,
std::is_nothrow_assignable< internal_resource_type&, typename detail::move_or_copy_assign_ref< R, resource_type >::type >
Expand Down Expand Up @@ -1508,7 +1508,7 @@ class unique_resource
void reset_impl(R&& res, std::true_type) noexcept
{
reset();
m_data.assign_resource(static_cast< R&& >(res));
m_data.assign_resource(static_cast< typename detail::move_or_copy_assign_ref< R, resource_type >::type >(res));
}

//! Assigns a new resource object to the unique resource wrapper.
Expand All @@ -1518,7 +1518,7 @@ class unique_resource
try
{
reset();
m_data.assign_resource(static_cast< R&& >(res));
m_data.assign_resource(static_cast< typename detail::move_or_copy_assign_ref< R, resource_type >::type >(res));
}
catch (...)
{
Expand Down

0 comments on commit 6f2adf3

Please sign in to comment.