template friend function

M

Marc Schellens

I have:

template<class Sp>
class Data_: public Sp
{
public:
typedef typename Sp::Ty Ty;
typedef Sp Traits;

private:
typedef typename Sp::DataT DataT;
DataT dd; // the data

public:
//structors

~Data_() {};

// default
Data_(): Sp(), dd() {}

....

// line 169
// convert *this to other 'destTy'
BaseGDL* Convert2( DType destTy,
BaseGDL::Convert2Mode=BaseGDL::CONVERT);

// line 174
// make all other Convert2 functions friends
template<class Sp2>
friend BaseGDL* Data_<Sp2>::Convert2( DType destTy,
BaseGDL::Convert2Mode);

....
};

which compiles fine with gcc 3.2
But with gcc 3.3 I got:

datatypes.hpp:174: error: prototype for `template<class Sp2> BaseGDL*
Data_::Convert2(DType, BaseGDL::Convert2Mode)' does not match any in
class `Data_<<anonymous template type parameter> >'
datatypes.hpp:169: error: candidate is: BaseGDL* Data_<<anonymous
template type parameter> >::Convert2(DType, BaseGDL::Convert2Mode)

Question: is this not standard conform? If not, any suggestions how to
do it (having one template member function wich is friend to all
instantiations of the template)?
Or is it a glitch in the compiler?

thanks,
marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,779
Messages
2,569,606
Members
45,239
Latest member
Alex Young

Latest Threads

Top