Pārlūkot izejas kodu

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

main
offa pirms 7 gadiem
vecāks
revīzija
94d46c2673
2 mainītis faili ar 0 papildinājumiem un 24 dzēšanām
  1. +0
    -10
      include/unique_resource.h
  2. +0
    -14
      test/UniqueResourceTest.cpp

+ 0
- 10
include/unique_resource.h Parādīt failu

@@ -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 Parādīt failu

@@ -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));

Notiek ielāde…
Atcelt
Saglabāt