suppose we have template class X and template function
template <class A, class B> A* g (B&);
how to make something like that?
template <class T>
class X {
template <class A, class B>
friend B* g (T&);
};
i mean that g<A, B> () is only friend of X <B>?
sopel39
0
Newbie Poster
Recommended Answers
Jump to Post> i mean that g<A, B> () is only friend of X <B>?
template < typename T1, typename T2 > T1* g( T2& ) ; class A ; template < typename T > class X { friend A* g <> ( T& ) ; // ... };
Jump to Postthe friend function that you require for this has a different signature.
#include <iostream> template < typename T1, typename T2 > T1* g ( T2& ) ; template < typename T > class X { private: T *ptr; public: X (T *ptr) : ptr (ptr) {} friend …
All 5 Replies
vijayan121
1,152
Posting Virtuoso
sopel39
0
Newbie Poster
vijayan121
1,152
Posting Virtuoso
sopel39
0
Newbie Poster
vijayan121
1,152
Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.