Connecting Tech Pros Worldwide Forums | Help | Site Map

Error compiling template function within class template

uvts_cvs@yahoo.com
Guest
 
Posts: n/a
#1: Jul 22 '05
template <class T>
class foo
{

public:
template <class Tin>
T bar (Tin) {return T();}

};

class derived : public foo<derived>
{

};

Is this little chunk of code ISO C++ compliant?

Some compilers compile it successfully, while another tells me that
'derived' is undefined within the class template.


Victor Bazarov
Guest
 
Posts: n/a
#2: Jul 22 '05

re: Error compiling template function within class template


uvts_cvs@yahoo.com wrote:[color=blue]
> template <class T>
> class foo
> {
>
> public:
> template <class Tin>
> T bar (Tin) {return T();}
>
> };
>
> class derived : public foo<derived>
> {
>
> };
>
> Is this little chunk of code ISO C++ compliant?
>
> Some compilers compile it successfully, while another tells me that
> 'derived' is undefined within the class template.
>[/color]
This is not a chat room. You have to have patience in Usenet.
uvts_cvs@yahoo.com
Guest
 
Posts: n/a
#3: Jul 22 '05

re: Error compiling template function within class template


I'm sorry but my client gives me an error the first time.

Closed Thread