Given a class template, for example
template <typename> class Template;
you can either befriend a particular specialisation of the template:
friend class Template<int>;
or all specialisations:
template <typename> friend class Template;
Domanda
I just need:
Correct syntax of making a "class template" friend to a class
Soluzione 2
Given a class template, for example
template <typename> class Template;
you can either befriend a particular specialisation of the template:
friend class Template<int>;
or all specialisations:
template <typename> friend class Template;
Altri suggerimenti
If you want a different typed friend class:
template<typename,typename> friend class ClassName;
In C++11 you can do this:
template<typename T>
class C
{
friend T;
};