Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define declare_singleton(class) \
- private: \
- class(); \
- class(const class&); \
- class(class&); \
- void operator=(const class&); \ //usw
- ~class(); \
- public: \
- friend class &singleton<class>();
- #define define_singleton(class) \
- template <typename T> \
- T &fSingleton(){ \
- static T t; \
- return t; \
- } \
- class &S_##class=fSingleton<class>();
- //x.h
- extern class x{
- declare_singleton(x);
- } &S_x;
- //x.cpp
- define_singleton(x);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement