[Solved] unordered linked list in C++ [closed]


Minimized example:

template <class T>
struct Base {
    int foo;
};

template <class T>
struct Derived : Base<T> {
    void bar() { foo = 0; }
};

This doesn’t compile because foo is a nondependent name so it’s looked up at template definition time, and this lookup doesn’t consider the base class template because Base can be explicitly specialized later so there’s no guarantee that it actually has a member called foo.

To fix this, use this->foo or Base<T>::foo to make it a dependent name, or add a using declaration in Derived to bring foo in scope – using Base<T>::foo;.

0

solved unordered linked list in C++ [closed]