return m_resource; | 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 | const D& get_deleter() const noexcept | ||||
{ | { | ||||
return m_deleter; | return m_deleter; |
REQUIRE(guard->first == 3); | REQUIRE(guard->first == 3); | ||||
REQUIRE(guard->second == 4); | 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]") | TEST_CASE("deleter access", "[UniqueResource]") | ||||
{ | { |