I want to derive from a template base class using the curious recurrent pattern:
template<typename A, typename B>
struct base
{
typedef A type;
};
template<typename B>
struct derived : public base<derived, B>
{
// Own attributes.
};
But the compiler (g++ 4.7.2) tells me the arguments (derived/A) doesn’t match.
How should I do it?
You’re getting the error becaused
derivedis a class template, and you’re leaving out its template parameters. You need to specify the template parameters forderived: