I'd like to do something like this:
template <typename T>
constexpr ::std::size_t type_name_hash()
{
return ::std::hash<::std::string>()(typeid(T).name());
}
Now, I know neither hash
nor string
are constexpr
, but this could be worked around, assume they are constexpr
. What I want to ask is, if RTTI
was turned on, should a constexpr
function computing a hash of typeid(T).name()
still produce a compile-time constant? How about when RTTI
is turned off?