[GCC-XML] Nested template class not declared?
Brad King
brad.king at kitware.com
Fri Mar 30 20:21:25 EDT 2007
Wesley Tansey wrote:
> Sorry, to clarify: I mean it does not output fields for the classes
> A<int> nor A<double>.
[snip]
>>> class B
>>> {
>>> std::map<std::map<A<int>, int>, std::vector<double> > combo;
>>> std::map<A<double>, int> single;
>>> }
This is because nothing in your example actually causes the templates to
be instantiated. If you create an instance of B in main then A<double>
will get instantiated and dumped. GCC-XML does not dump un-instantiated
templates. There is a FAQ entry about why. You can force the
instantiation of A<double> like this:
struct B
{
typedef A<double>::A key_type;
std::map<key_type, int> single;
};
Note the "::A" in the typedef. This access a member of A<double> which
forces instantiation of its interface.
-Brad
More information about the gccxml
mailing list