G ++ to show which classes are created from templates.

Is there a g ++ option that shows which classes are created from templates? For example, in the source code there is a template definition:

template <class T>
struct SomeStruct { T variable; };

SomeStruct<int> instance;

and I would like to see an implementation of SomeStruct <Int>.

+5
source share
2 answers

You can get this information using the flag -fdump-class-hierarchy. It will list a lot more than you ask, but if you are looking for lines starting with Class, you will find what you are looking for.

EDIT : Here is the output from the program including iostream. You can see that there are instances charand wchar_t:

Class std::basic_ostream<char, std::char_traits<char> >
Class std::basic_ostream<char, std::char_traits<char> >::sentry
Class std::basic_ostream<wchar_t, std::char_traits<wchar_t> >
Class std::basic_ostream<wchar_t, std::char_traits<wchar_t> >::sentry
Class std::basic_istream<char, std::char_traits<char> >
Class std::basic_istream<wchar_t, std::char_traits<wchar_t> >
Class std::basic_istream<char, std::char_traits<char> >::sentry
Class std::basic_iostream<char, std::char_traits<char> >
Class std::basic_istream<wchar_t, std::char_traits<wchar_t> >::sentry
Class std::basic_iostream<wchar_t, std::char_traits<wchar_t> >
+4
source

, : T.

struct SomeStruct<int> { int variable; };
-1

All Articles