[GCC-XML]Templated methods questions

Pere Mato Vila Pere.Mato at cern.ch
Fri Mar 12 11:37:43 EST 2004


  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="_3" name="TMethods" context="_1" mangled="8TMethods"
location="f0:2" file="f0" line="2" members="_4 _5 " bases=""/>
...
<Method id="_6" name="get" returns="_10" const="1" context="_3"
mangled="_ZNK8TMethods3getIfEET_v" location="f0:4" file="f0" line="4"
endline="4"/>
<Method id="_7" name="get" returns="_11" const="1" context="_3"
mangled="_ZNK8TMethods3getIiEET_v" location="f0:4" file="f0" line="4"
endline="4"/>
<Method id="_8" name="set" returns="_12" context="_3"
mangled="_ZN8TMethods3setIiEEvRKT_" location="f0:5" file="f0" line="5"
endline="5">
    <Argument name="d" type="_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? 
 

------------------------------------------------------------
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

 



More information about the gccxml mailing list