30 using nothrow_move_t = std::is_nothrow_move_constructible<Fun>;
31 using nothrow_copy_t = std::is_nothrow_copy_constructible<Fun>;
34 bool dismissed_{
false};
36 using ref_t =
decltype(std::ref(std::declval<Fun const &>()));
37 using guard = scope_exit<ref_t>;
39 scope_exit(Fun
const & fun, guard && g)
45 scope_exit(Fun
const & fun, std::false_type)
46 : scope_exit(fun, guard{std::ref(fun)})
49 scope_exit(Fun
const & fun, std::true_type) noexcept
53 scope_exit(Fun && fun, std::true_type) noexcept
54 : fun_(std::move(fun))
58 explicit scope_exit(Fun
const & fun)
noexcept(
59 noexcept(scope_exit(fun, nothrow_copy_t{})))
60 : scope_exit(fun, nothrow_copy_t{})
63 explicit scope_exit(Fun && fun)
noexcept(
noexcept(scope_exit(std::move(fun),
65 : scope_exit(std::move(fun), nothrow_move_t{})
68 scope_exit(scope_exit
const &) =
delete;
70 scope_exit(scope_exit && that)
noexcept(
71 std::is_nothrow_move_constructible<Fun>::value)
72 : scope_exit(std::move((that.dismiss(), that)).fun_)
81 void dismiss()
noexcept