RESTinio
restinio
utils
at_scope_exit.hpp
Go to the documentation of this file.
1
/*
2
* SObjectizer-5, RESTinio
3
*/
4
17
#pragma once
18
19
#include <utility>
20
21
namespace
restinio
{
22
23
namespace
utils {
24
25
namespace
scope_exit_details {
26
30
template
<
typename
L >
31
class
at_exit_t
32
{
33
L
m_lambda
;
34
public :
35
at_exit_t
( L && l ) :
m_lambda
{
std
::forward<L>(l) } {}
36
at_exit_t
(
at_exit_t
&& o ) :
m_lambda
{
std
::
move
(o.
m_lambda
) } {}
37
~at_exit_t
() {
m_lambda
(); }
38
};
39
40
}
/* namespace scope_exit_details */
41
58
template
<
typename
L >
59
scope_exit_details::at_exit_t< L >
60
at_scope_exit
( L && l )
61
{
62
return
scope_exit_details::at_exit_t<L>
{ std::forward<L>(l) };
63
}
64
65
}
/* namespace utils */
66
67
}
/* namespace restinio */
68
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.
Generated by
1.9.3