53template <
typename TFunc>
62 : m_func(
std::forward<TFunc>(func)),
76 : m_func(
std::move(guard.m_func)),
77 m_engaged(
std::move(guard.m_engaged))
111 typename std::remove_reference<TFunc>::type m_func;
130template <
typename TFunctor>
157template <
typename TFunc,
160ScopeGuard<
decltype(std::bind(std::forward<TFunc>(func),
161 std::forward<TParams>(args)...))>
163 auto bindObj = std::bind(std::forward<TFunc>(func), std::forward<TParams>(args)...);
Implements Scope Guard Idiom.
Definition ScopeGuard.h:55
ScopeGuard(const ScopeGuard &guard)=delete
No copy is allowed.
void release()
Release the bound functor.
Definition ScopeGuard.h:98
~ScopeGuard() noexcept
Destructor.
Definition ScopeGuard.h:86
bool isReleased() const
Check whether the functor is released.
Definition ScopeGuard.h:105
ScopeGuard(TFunc &&func)
Constructor.
Definition ScopeGuard.h:61
auto makeScopeGuard(TFunc &&func, TParams... args) -> ScopeGuard< decltype(std::bind(std::forward< TFunc >(func), std::forward< TParams >(args)...))>
Create scope guard by binding the provided function and all the arguments.
Definition ScopeGuard.h:159
ScopeGuard< TFunctor > makeScopeGuard(TFunctor &&func)
Create scope guard with provided functor.
Definition ScopeGuard.h:131
ScopeGuard(ScopeGuard &&guard)
Move constructor.
Definition ScopeGuard.h:75
ScopeGuard & operator=(const ScopeGuard &guard)=delete
No copy is allowed.
Main namespace for all classes / functions of COMMS library.