add counter
This commit is contained in:
parent
cb55987746
commit
9f47c86bc2
12
bin/main.cpp
12
bin/main.cpp
@ -41,6 +41,13 @@ struct ForTypeTrace
|
||||
int a;
|
||||
};
|
||||
|
||||
struct counter_test : public hack::utils::counter<int>
|
||||
{
|
||||
counter_test() : id { ++hack::utils::counter<int>::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<decltype ('c')>::value);
|
||||
hack::log()(hack::security::is_string<decltype ("c")>::value);
|
||||
}
|
||||
|
||||
{
|
||||
counter_test a, b, c;
|
||||
hack::log()(c.id);
|
||||
}
|
||||
}
|
||||
|
@ -62,4 +62,10 @@ namespace hack::utils
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
template<typename T, T value = 0>
|
||||
struct counter
|
||||
{
|
||||
inline static T id = value;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user