at_scope_exit.hpp
Go to the documentation of this file.
/*
* SObjectizer-5, RESTinio
*/
#pragma once
#include <utility>
namespace restinio {
namespace utils {
namespace scope_exit_details {
template< typename L >
class at_exit_t
{
L m_lambda;
public :
at_exit_t( L && l ) : m_lambda{ std::forward<L>(l) } {}
at_exit_t( at_exit_t && o ) : m_lambda{ std::move(o.m_lambda) } {}
~at_exit_t() { m_lambda(); }
};
} /* namespace scope_exit_details */
template< typename L >
scope_exit_details::at_exit_t< L >
at_scope_exit( L && l )
{
return scope_exit_details::at_exit_t<L>{ std::forward<L>(l) };
}
} /* namespace utils */
} /* namespace restinio */
restinio::utils::scope_exit_details::at_exit_t
Helper class for scope exit implementation.
Definition: at_scope_exit.hpp:32
restinio::utils::scope_exit_details::at_exit_t::m_lambda
L m_lambda
Definition: at_scope_exit.hpp:33
restinio::utils::scope_exit_details::at_exit_t::at_exit_t
at_exit_t(L &&l)
Definition: at_scope_exit.hpp:35
restinio::utils::scope_exit_details::at_exit_t::~at_exit_t
~at_exit_t()
Definition: at_scope_exit.hpp:37
restinio::utils::scope_exit_details::at_exit_t::at_exit_t
at_exit_t(at_exit_t &&o)
Definition: at_scope_exit.hpp:36
nonstd::optional_lite::std11::move
T & move(T &t)
Definition: optional.hpp:465
restinio::utils::at_scope_exit
scope_exit_details::at_exit_t< L > at_scope_exit(L &&l)
Helper function for creation action to be performed at scope exit.
Definition: at_scope_exit.hpp:60
restinio
Definition: asio_include.hpp:21
std
STL namespace.