Since typeid
is applied to a type rather than an object, there is no runtime type information, so that overhead won't be a problem.
On the other hand: as far as I can see, the standard makes no requirements regarding when the value will be determined, so there's no guarantee that there's no runtime overhead.
Edit:
Of course, the fact that there's (possibly) no guarantee doesn't mean that it's not a reasonable assumption.
I can't imagine that anyone would write a compiler that didn't evaluate typeid(T)
at compile time.