1
This commit is contained in:
parent
934906d968
commit
73a4706673
12
a8/a8.h
12
a8/a8.h
@ -49,4 +49,16 @@ struct Context \
|
|||||||
}; \
|
}; \
|
||||||
return std::make_shared<Context>();}()
|
return std::make_shared<Context>();}()
|
||||||
|
|
||||||
|
#define A8_MAKE_SMART_ANON_STRUCT_SHARED(...) \
|
||||||
|
[] () \
|
||||||
|
{ \
|
||||||
|
struct Context : public std::enable_shared_from_this<Context> \
|
||||||
|
{ \
|
||||||
|
__VA_ARGS__; \
|
||||||
|
std::function<void()> _destory_cb; \
|
||||||
|
std::weak_ptr<Context> GetWp() { return shared_from_this();}; \
|
||||||
|
~Context() { if (_destory_cb) { _destory_cb(); };}; \
|
||||||
|
}; \
|
||||||
|
return std::make_shared<Context>();}()
|
||||||
|
|
||||||
const float A8_PI = 3.1415926f;
|
const float A8_PI = 3.1415926f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user