I have a class:
template<typename T, typename Alloc = std::allocator<T>>
class CCircularBuffer {
protected:
size_t size_ = 0;
size_t max_size_{};
T* values_;
size_t begin_ = 0;
size_t end_ = 0;
Alloc alloc_;
public:
virtual void resize(size_t size);
};
And the class that inherits it:
template <typename T, typename Alloc>
class CCircularBufferExt: public CCircularBuffer<T, Alloc> {
public:
void resize(size_t n);
};
But when I try to use fields from the CCircularBuffer class, the compiler does not see them:
Error: Use of undeclared identifier 'values_'
template<typename T, typename Alloc>
void CCircularBufferExt<T, Alloc>::resize(size_t n) {
values_ = alloc_.allocate(n);
}
What could be the problem? And am I using inheritance correctly?
I thought the problem was that the compiler doesn't see the CCircularBuffer class, but it seems to see it anyway...
Error screenshot: enter image description here