로딩중...
검색중...
일치하는것 없음
end.hpp
이 파일의 문서화 페이지로 가기
1
2#pragma once
3
4#include "indep/common.hpp"
5#include "indep/macro.hpp"
6
7namespace by {
8
36 class _nout end {
37 BY(ME(end))
38
39 public:
40 end(std::function<void(void)> l);
41 ~end();
42
43 private:
44 std::function<void(void)> _lambda;
45 };
46
47// e.g.
48// BY_END_BLOCK({
49// ....doSomething()
50// });
51// or,
52// BY_END(doSomething());
53#define BY_END_BLOCK_2(__class, blockStmt) auto BY_CONCAT(__defer__, __COUNTER__) = __class(blockStmt)
54#define BY_END_BLOCK_1(blockStmt) BY_END_BLOCK_2(end, [&]() blockStmt)
55#define BY_END_BLOCK(...) BY_OVERLOAD(BY_END_BLOCK, __VA_ARGS__)
56
57#define BY_END_2(__class, stmt) auto BY_CONCAT(__defer__, __COUNTER__) = __class(stmt)
58#define BY_END_1(stmt) BY_END_2(end, ([&]() { stmt; }))
59#define BY_END(...) BY_OVERLOAD(BY_END, __VA_ARGS__)
60} // namespace by
Deferred execution utility similar to defer keyword in other languages
Definition end.hpp:36
to Top