Friending a template function member in a template class

J

jrwats

I am trying to get the following to work, but can't seem to get the
template syntax correct:

template<class T>
class ComplexCreator {
template<class X>
int Create(FriendSelf<X>** ppFS);
};

template<class T>
class FriendSelf
{
public:
template<class U>
static int Create(FriendSelf<U>** ppFS);


template<class U> template<class X>
friend int FriendSelf<U>:: Create<> (FriendSelf<T>**);
// ^ here
// error: expected initializer before '<' token

template<class U>
friend int ComplexCreator<U>::
template<class>
// ^ here
// error: expected unqualified-id before '<' token
Create<> (FriendSelf<T>**);

template<class U>
template<class>
friend int ComplexCreator<U>::Create<>(FriendSelf<T>**);
// ^ here
// error: expected unqualified-id before '<' token


template<class U>
friend int ComplexCreator<U>::Create(FriendSelf<T>**);
// error: prototype for
// `int ComplexCreator<U>::Create(FriendSelf<MoreFiller>**)'
// does not match any in class `ComplexCreator<U>'

private:
FriendSelf(){}

};

So... I'm stumped. Please do not ask why I'm doing this. I left out
A LOT of details. If you really want to be confused, the Create
function is actually intended to be FriendSelf, but I separated it out
for clarity... if you can call it that.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top