feat update
All checks were successful
linux-x64-gcc / linux-gcc (Debug) (push) Successful in 1m1s
linux-x64-gcc / linux-gcc (Release) (push) Successful in 1m8s

This commit is contained in:
tqcq 2024-03-18 15:21:50 +08:00
parent 051117ac08
commit b23f0c35e0

View File

@ -23,20 +23,18 @@ WasDeduced()
}
}// namespace internal
template<typename Arg = internal::Tag,
typename Callback = std::function<void()>>
template<typename Arg = internal::Tag, typename Callback = std::function<void()>>
class Cleanup final {
public:
static_assert(internal::WasDeduced<Arg>(),
"Do not specify the first template argument");
static_assert(internal::WasDeduced<Arg>(), "Do not specify the first template argument");
Cleanup(Callback callback) : callback_(std::move(callback)) {}
Cleanup(Cleanup &&other) = default;
void Cancel() && { callback_.reset(); }
void Cancel() { callback_.reset(); }
void Invoke() &&
void Invoke()
{
assert(callback_);
(*callback_)();