I would like to implement the CRTP on a parameterized Base, and make Base a friend of Derived:
template <template <typename> class Derived, class T>
class Base;
template <class T>
class Derived : public Base<Derived, T>
{
friend class Base<Derived, T>;
};
I have a compilation error on VS2012 with the following message:
error C3200: 'Derived<T>' : invalid template argument for template parameter 'Derived', expected a class template
Thanks for your help.
Try this:
If that doesn't work, your compiler doesn't support this form of friend declaration (it should, but what do I know), and you'll have to work around by extending the friendship to all Base instantiations.