Connecting Tech Pros Worldwide Help | Site Map

template friend function

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 22nd, 2005, 05:10 AM
Marc Schellens
Guest
 
Posts: n/a
Default template friend function

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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.