[cfe-dev] TemplateArgumentList of out-of-line method of class template
Konstantin Tokarev
annulen at yandex.ru
Tue Oct 30 13:43:53 PDT 2012
28.10.2012, 15:12, "Konstantin Tokarev" <annulen at yandex.ru>:
> Hi all,
>
> Is it possible to get TemplateArgumentList from declaration of out-of-line method of class template, e.g.
>
> template<typename T1, typename T2>
> class B
> {
> public:
> static void hello();
> };
>
> template<typename T1, typename T2>
> void B<T1, T2>::hello() // <---- Here
> {
> }
>
> ?
>
> Background:
>
> I'm trying to set up one-one relationships between TemplateTypeParmDecl's in method definition and in base ClassTemplateDecl (e.g. find out that T1 inside hello() definition refers to the first parameter of B).
>
> I've tried to use template parameter declaration obtained from DeclaratorDecl::getTemplateParameterList(), however 1) there may be several template lists in CXXMethodDecl; 2) parameter ordering is not necessarily the same as in parameter list of B. Using TemplateArgumentList in B<T1, T2>::hello() should be more reliable.
Bump.
--
Regards,
Konstantin
More information about the cfe-dev
mailing list