Let\'s start with the code example, because it should be easy to see what\'s going on:
template
struct Base
{
using Type = int;
};
te
because Type
is a dependent name (it depends on the template Base<T>
). You need to qualify it and use typename
. You can also qualify it with Derived::
(as the op himself figure it out):
template<typename T>
struct Derived : public Base<T>
{
using NewType = typename Base<T>::Type;
// or
using NewType2 = typename Derived::Type;
};
You can read more about dependent names here:
https://en.cppreference.com/w/cpp/language/dependent_name
How do you understand dependent names in C++
Where and why do I have to put the "template" and "typename" keywords?
Why do I have to access template base class members through the this pointer?
"not declared in this scope" error with templates and inheritance