This is not a duplicate of this question.
Below, I list my base class as well as how I am deriving a class from it:
template<template<size_t, typename...> typename D>
struct Modifier
{
// some static variables
};
template<typename M, size_t U, typename T, typename... S>
struct Base
{
// some implementations
};
template<size_t U, typename T>
struct Derived;
template<>
struct Modifier<Derived>;
template<size_t U, typename T>
struct Derived : Base<Modifier<Derived>, U, T, double>
{
using Base<Modifier<Derived>, U, T, double>::Base;
};
To provide some context, the idea is that the implementation of Base
will access some static variables from M
in order to change the behaviour of a couple of functions.
When I compile this with msvc (build tools v142), it complains about:
1>...: error C3210: 'Base<Modifier<Derived<2,unsigned __int64> >,2,unsigned __int64,double>': a member using-declaration can only be applied to a base class member
1>...: error C3881: can only inherit constructor from direct base
Yet, when I introduce using mod_t = Modifier<Derived>;
and apply that in the implementation of Derived
instead of the full name, it correctly compiles.
By the way, whether I define Derived
like above or like:
template<size_t U, typename T>
struct Derived : Base<Modifier<Derived>, U, T, double>
{
using parent_type = Base<Modifier<Derived>, U, T, double>;
using parent_type::Base;
};
or
template<size_t U, typename T>
struct Derived : Base<Modifier<Derived>, U, T, double>
{
using parent_type = Base<Modifier<Derived>, U, T, double>;
using parent_type::parent_type;
};
I will still get an error.
What am I missing here?