Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int NO_INDEX = -1;
- template <typename T>
- struct StaticType
- {
- static int type;
- };
- template <typename T> int StaticType<T>::type = NO_INDEX;
- static int _uniqueType = 0;
- struct UID
- {
- template <typename T>
- static int Get()
- {
- if (StaticType<T>::type != NO_INDEX)
- {
- return StaticType<T>::type;
- }
- else
- {
- ++_uniqueType;
- StaticType<T>::type = _uniqueType;
- }
- return StaticType<T>::type;
- }
- };
Add Comment
Please, Sign In to add comment