Is there some g++ option which shows what classes are created from templates? For example there is template definition in original source code:
template <class T>
struct SomeStruct { T variable; };
SomeStruct<int> instance;
and I would like to see implementation of SomeStruct< int>.
You can get that info with the -fdump-class-hierarchy
flag. It'll list a lot more than you're asking for, but if search for lines that start with Class
, you'll find what you're looking for.
EDIT: Here's some output from a program that includes iostream
. You can see there are instantiations of char
and 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> >
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With