[GCC-XML]Templated methods questions

Pere Mato Vila Pere.Mato at cern.ch
Fri, 12 Mar 2004 17:37:43 +0100


  I have a couple of questions concerning the generated information for
templated methods. If I have class as following one with some explicit
member function template instantiations

class TMethods {
  public:
    template <class T> T get() const { return T(); }
    template <class T> void set(const T& d) { }
};

template int    TMethods::get<int>() const;
template float  TMethods::get<float>() const;
template void   TMethods::set(const int&);

I obtain with gccxml (0.6.0) the following:

...
<Class id=3D"_3" name=3D"TMethods" context=3D"_1" mangled=3D"8TMethods"
location=3D"f0:2" file=3D"f0" line=3D"2" members=3D"_4 _5 " bases=3D""/>
...
<Method id=3D"_6" name=3D"get" returns=3D"_10" const=3D"1" =
context=3D"_3"
mangled=3D"_ZNK8TMethods3getIfEET_v" location=3D"f0:4" file=3D"f0" =
line=3D"4"
endline=3D"4"/>
<Method id=3D"_7" name=3D"get" returns=3D"_11" const=3D"1" =
context=3D"_3"
mangled=3D"_ZNK8TMethods3getIiEET_v" location=3D"f0:4" file=3D"f0" =
line=3D"4"
endline=3D"4"/>
<Method id=3D"_8" name=3D"set" returns=3D"_12" context=3D"_3"
mangled=3D"_ZN8TMethods3setIiEEvRKT_" location=3D"f0:5" file=3D"f0" =
line=3D"5"
endline=3D"5">
    <Argument name=3D"d" type=3D"_13"/>
</Method>
...

The questions are:
 - Why Methods _6 _7 _8 are not members of Class _3 ? Note that the
reverse relation ( via Context )is true.
 - The name of the method _6 and _7 is "get" in both cases, but in C++
the names are in fact "get<int>" and "get<float>". Is there a way to
obtain the real C++ name?=20
=20

------------------------------------------------------------
Pere Mato  CERN, PH Department, CH 1211 Geneva 23, Switzerland
           e-mail: Pere.Mato at cern.ch    tel: +41 22 76 78696
           fax:  +41 22 76 79425        gsm: +41 76 48 70855

=20