Przeglądaj źródła

Deduction guide for scope_exit implemented (#80).

main
offa 7 lat temu
rodzic
commit
44830430ab
2 zmienionych plików z 5 dodań i 1 usunięć
  1. +4
    -0
      include/scope_exit.h
  2. +1
    -1
      test/ScopeExitTest.cpp

+ 4
- 0
include/scope_exit.h Wyświetl plik

}; };




template <class EF>
scope_exit(EF &&ef) -> scope_exit<std::decay_t<EF>>;


template<class EF> template<class EF>
scope_exit<std::decay_t<EF>> make_scope_exit(EF&& exitFunction) scope_exit<std::decay_t<EF>> make_scope_exit(EF&& exitFunction)
{ {

+ 1
- 1
test/ScopeExitTest.cpp Wyświetl plik

TEST_CASE("exit function called on destruction", "[ScopeExit]") TEST_CASE("exit function called on destruction", "[ScopeExit]")
{ {
REQUIRE_CALL(m, deleter()); REQUIRE_CALL(m, deleter());
auto guard = sr::make_scope_exit(deleter);
auto guard = sr::scope_exit(deleter);
static_cast<void>(guard); static_cast<void>(guard);
} }



Ładowanie…
Anuluj
Zapisz