@@ -159,6 +159,13 @@ namespace sr | |||
return m_resource; | |||
} | |||
template<class RR = R, | |||
std::enable_if_t<std::is_pointer<RR>::value, int> = 0> | |||
std::add_lvalue_reference_t<std::remove_pointer_t<RR>> operator*() const noexcept | |||
{ | |||
return *get(); | |||
} | |||
const D& get_deleter() const noexcept | |||
{ | |||
return m_deleter; |
@@ -229,7 +229,13 @@ TEST_CASE("pointer access resturns resource" "[UniqueResource]") | |||
REQUIRE(guard->first == 3); | |||
REQUIRE(guard->second == 4); | |||
} | |||
// TODO: Pointer access functions | |||
TEST_CASE("pointer dereference resturns resource" "[UniqueResource]") | |||
{ | |||
Handle h{5}; | |||
auto guard = sr::make_unique_resource(PtrHandle{&h}, [](auto*) { }); | |||
REQUIRE(*guard == 5); | |||
} | |||
TEST_CASE("deleter access", "[UniqueResource]") | |||
{ |