[LC++]Template classes and Friends

Vincent Penquerc'h Vincent.Penquerch at artworks.co.uk
Wed Sep 11 19:21:05 UTC 2002


> Is there any way I can make class A a friend of class
> B only when the template parameter TYP2 of A is the
> same as TYP2 of class B in instantiation ?

I don't know for sure, but have you tried:

template <class TYP1>
class A {
.....
  friend class B<TYP1>;
};

There might be problems with recognizing A<t> with A<t,t>,
so it there are you may want to try partially specializing
A (I don't have the right syntax offhand, sorry). Just a
couple ideas, I don't give any assurance it would work :)

-- 
Vincent Penquerc'h 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/tuxcpprogramming/attachments/20020911/000fc43a/attachment.htm 


More information about the tuxCPProgramming mailing list