Browse Source

Swap() removed from unique_resource (fixes #102).

main
offa 7 years ago
parent
commit
94d46c2673
2 changed files with 0 additions and 24 deletions
  1. +0
    -10
      include/unique_resource.h
  2. +0
    -14
      test/UniqueResourceTest.cpp

+ 0
- 10
include/unique_resource.h View File

@@ -88,16 +88,6 @@ namespace sr
}


void swap(unique_resource& other) noexcept(std::is_nothrow_swappable_v<R>
&& std::is_nothrow_swappable_v<D>
&& std::is_nothrow_swappable_v<bool>)
{
using std::swap;
swap(m_resource.get(), other.m_resource.get());
swap(m_deleter.get(), other.m_deleter.get());
swap(m_execute_on_destruction, other.m_execute_on_destruction);
}

void reset()
{
if( m_execute_on_destruction == true )

+ 0
- 14
test/UniqueResourceTest.cpp View File

@@ -177,20 +177,6 @@ TEST_CASE("deleter access", "[UniqueResource]")
}
}

TEST_CASE("swap", "[UniqueResource]")
{
REQUIRE_CALL(m, deleter(7));
auto guard1 = sr::unique_resource(Handle{3}, deleter);

{
REQUIRE_CALL(m, deleter(3));
auto guard2 = sr::unique_resource{Handle{7}, deleter};
guard2.swap(guard1);
REQUIRE(guard1.get() == 7);
REQUIRE(guard2.get() == 3);
}
}

TEST_CASE("make unique resource", "[UniqueResource]")
{
REQUIRE_CALL(m, deleter(7));

Loading…
Cancel
Save