I cannot find the answer to this seemingly simple question anywhere.
Does the following C++ function use RTTI? It certainly doesn't have to, but I was wondering if there is a guarantee that typeid will be determined at compile time.
template <typename T>
const char *getName()
{
return typeid(T).name(); // Resolved at compile time?
}
T
was? – Octettypeid(T)
ortypeid(x)
where the static type ofx
is a concrete class, but it is never a constant-expression. – RelationshipT
is a type, not an object. (If you were responding to my first comment.) – Octettypeid
so there can be no RTTI. Instead just ask if "typeid( typeid )" is resolved at compile time. – Octet