This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Friend class within templates
- From: b u <bnulbig at yahoo dot com>
- To: gcc-help at gcc dot gnu dot org
- Cc: stuartb at cat dot co dot za
- Date: Mon, 19 Jul 2004 11:58:58 -0700 (PDT)
- Subject: Re: Friend class within templates
I didn't read the template standard very closely, but
I figure the gcc folks did. Anyway, the wrapper below
gets around the issue:
// Forward decl.
template< class T > class Wrapper;
//------------------------------------------//
template<class T> class OwnerTemplate
{
// friend decl.
friend class Wrapper< T >;
....
};
template<class T> class Wrapper
{
public:
void callOwner( OwnerTemplate<T>* owner )
{ owner->calledFromT(); }
};
....
//-----------------------------------------//
class MyClass
{
....
void callOwner()
{ Wrapper< MyClass >().callOwner( owner ); }
....
};
Best,
Ben
__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/