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