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.
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.