Re: Friend class within templates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux