G
Gianni Mariani
The code below compiles on gcc 3.4.0 and Comeau's 4.3.3 but MSVC++ 7.1
dies complaining about somthing <unknown>.
Is this valid ?
More to the point, is there any way of doing this that is supported
across all 3 compilers ? I want a template to take a parameter and
make it it's friend.
<code>
struct x
{
template <typename T>
static void X( T t )
{
delete t;
}
};
template <typename T=x>
class Foo
{
template <typename T2>
friend void T::X( T2 t );
~Foo(){}
public:
void FinishMe()
{
T::X( this );
}
};
int main()
{
Foo<> * zz = new Foo<>;
zz->FinishMe();
}
</code>
dies complaining about somthing <unknown>.
Is this valid ?
More to the point, is there any way of doing this that is supported
across all 3 compilers ? I want a template to take a parameter and
make it it's friend.
<code>
struct x
{
template <typename T>
static void X( T t )
{
delete t;
}
};
template <typename T=x>
class Foo
{
template <typename T2>
friend void T::X( T2 t );
~Foo(){}
public:
void FinishMe()
{
T::X( this );
}
};
int main()
{
Foo<> * zz = new Foo<>;
zz->FinishMe();
}
</code>