end.hpp
Go to the documentation of this file.
1
2
#pragma once
3
4
#include "
indep/common.hpp
"
5
#include "
indep/macro.hpp
"
6
7
namespace
by {
8
14
class
_nout
end
{
15
BY(ME(
end
))
16
17
public
:
18
end
(std::function<
void
(
void
)> l);
19
~end
();
20
21
private
:
22
std::function<void(
void
)> _lambda;
23
};
24
25
// e.g.
26
// BY_END_BLOCK({
27
// ....doSomething()
28
// });
29
// or,
30
// BY_END(doSomething());
31
#define BY_END_BLOCK(blockStmt) auto __defer__##__COUNTER__ = end([&]() blockStmt)
32
#define BY_END(stmt) auto __defer__##__COUNTER__ = end([&]() { stmt; })
33
}
by::end
Deferred execution utility like defer keyword in other languages.
Definition:
end.hpp:14
common.hpp
macro.hpp