I'd like to avoid listing all the functions in a template class as friends by declaring the whole class as a friend, but...
Am I missing the obvious?
I'm using i686-apple-darwin10-g++-4.2.1
Code:
template<class T1> class A; template<class T1, class T2> class B; template<class T1> class C { friend void A<T1>::f1(void); friend void A<T1>::f2(void); friend void A<T1>::f3(void); friend class A<T1>; template<class T2> friend void B<T1,T2>::f1(void); template<class T2> friend void B<T1,T2>::f2(void); template<class T2> friend void B<T1,T2>::f3(void); /* * why is everything above allowed, * but not the following line? */ template<class T2> friend class B<T1,T2>; // error: partial specialization 'B<T1, T2>' declared 'friend' };
I'm using i686-apple-darwin10-g++-4.2.1
Comment