Hello all,

A friend of mine is attempting to display the type of a template parameter (for whatever reason) and has used -fno-rtti, it makes sense that typeid doesn't work (from <typeinfo>) because there is no type id. However I must say I find it shocking there is no mechanism that GCC provides to do this. I do of course accept that there can be no (pure) macro that can do this but the type of a variable is something that is most certainly available at compile time.

I must say I find the usefulness of such a thing questionable but I do not see this as a reason to not have "it". It refers to a "function" (I'm not sure what to call it, I dare not say macro) that takes an expression and returns the name of the expressions type as a const char*.

Is there any reason it doesn't exist?

There is a work around where __PRETTY_FUNCTION__ may be used and then parsed to find template parameters but this is an awful solution.

Alec

(Additional/extra question: how might one go about adding such a thing? What would it look like?)

Reply via email to