Suppose I've written a foo<T>
function (I have a full signature with namespaces), but never mind that right now); and suppose there is no other function overloading it (in the relevant namespace it's in). Now let's place ourselves at runtime. Suppose I have the string "foo", and for some type MyType
, I have typeid(MyType)
(from the <memory>
header).
Can I somehow obtain the symbol name for foo<MyType>
?
Second version of this question: Now suppose I have the full signature of foo as a string, instead of just the name; and drop the assumption about no overloads.
Notes:
- No, I'm not asking about the symbol itself, just the name. That would be an interesting question for another time.
- Answers which depend on
foo<T>
coming from a shared library are relevant, although I don't think it should matter just for the symbol name. - I don't care about performance here, I'll do whatever it takes. Help me Obi Wan, you're my last hope etc. So, RTTI, compiling with weird flags, whatever.
- Platform-dependent answers are also relevant: GNU/Linux with kernel version >= 3.x , an x86_64 CPU , gcc >= 4.8 .