Suppose I have the following:
class Foo { };
template <typename T> class Bar { };
template <typename NiftyType> class Baz { };
In modern(ish) C++, I can use:
typeid(Foo).name() // to will produce "Foo", or
typeid(Bar<int>).name() // to produce "Bar<int>"
But that last line gives me the actual template parameters; I want the formal ones. That is, I want to be able to say:
magic<Bar<int>>(); // to produce "Bar<typename T>" or just "T", and
magic<Baz<int>>(); // to produce "Bar<typename Nifty>" or just "Nifty"
Can I do this somehow?
Aucun commentaire:
Enregistrer un commentaire