Alternative id generators for types
问题 In a project of mine, I have an ID generator for types that looks similar to this: class Family { static std::size_t identifier; template<typename...> static std::size_t family() { static const std::size_t value = identifier++; return value; } public: template<typename... Type> inline static std::size_t type() { return family<std::decay_t<Type>...>(); } }; std::size_t Family::identifier{}; Usage: const auto id = Family::type<FooBar>(); It works just fine for my purposes, but it has some