add singleton template
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "hack/logger/logger.hpp"
|
||||
#include "hack/utils/utils.hpp"
|
||||
#include "hack/utils/singleton.hpp"
|
||||
#include "hack/utils/func_query.hpp"
|
||||
|
||||
int f(int a)
|
||||
@@ -32,6 +33,14 @@ struct counter_test_2
|
||||
int id;
|
||||
};
|
||||
|
||||
struct test_singleton : public hack::utils::singleton<test_singleton>
|
||||
{
|
||||
void print()
|
||||
{
|
||||
hack::log()("Print singleton");
|
||||
}
|
||||
};
|
||||
|
||||
auto main(int argc, char *argv[]) -> int
|
||||
{
|
||||
{// ex: utils::func_memory
|
||||
@@ -83,6 +92,10 @@ auto main(int argc, char *argv[]) -> int
|
||||
query = hack::utils::make_query("super_function");
|
||||
hack::log()("query", query);
|
||||
}
|
||||
|
||||
{// ex: singleton
|
||||
test_singleton::get_instance().print();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user