I'm trying to access a parent method from a derived template class, but despite using public access everywhere, and "this->" to be safe, I'm getting the error.
error: 'class Derived<TagTypeA, int>' has no member named 'insert'
I don't know if I'm making a stupid mistake somewhere, but I can't work out why the Derived class can't access the parent's stuff.
I have code that looks something like below, and also here: https://godbolt.org/z/nMbe4fMnM
#include <bits/stdc++.h>
struct TagTypeA;
template<typename T>
class Base {
public:
std::set<T> data;
void insert(const T& v) { data.insert(v); }
void erase(const T& v) { data.erase(v); }
};
template<typename Tag, typename T>
class Derived : public Base<T> {};
// specialization of Derived
template<typename T>
class Derived<TagTypeA, T> {
public:
void call_parent_insert(const T& v) { this->insert(v); }
};
int main()
{
Derived<TagTypeA, int> foo;
foo.call_parent_insert(1);
}