diff --git a/bin/main.cpp b/bin/main.cpp index f93fe2e..71c70b3 100644 --- a/bin/main.cpp +++ b/bin/main.cpp @@ -41,6 +41,13 @@ struct ForTypeTrace int a; }; +struct counter_test : public hack::utils::counter +{ + counter_test() : id { ++hack::utils::counter::id } { } + int id; + +}; + int main(int argc, char *argv[]) { {// ex: string::split_str @@ -218,4 +225,9 @@ int main(int argc, char *argv[]) hack::log()(hack::security::is_string::value); hack::log()(hack::security::is_string::value); } + + { + counter_test a, b, c; + hack::log()(c.id); + } } diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index b8f4852..274d9a7 100644 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -62,4 +62,10 @@ namespace hack::utils return result; } + + template + struct counter + { + inline static T id = value; + }; }