I have something that i can't understand.
With one basic template class:
#ifndef DBUFFER_HPP
#define DBUFFER_HPP
#include <memory>
namespace memory {
template <template <typename T, class Alloc = std::allocator<T> > class Stock, class Unit>
class DBuffer {
typedef Stock<Unit> buffer_t;
protected:
const std::size_t m_sizeMax;
std::unique_ptr<buffer_t> m_data;
std::unique_ptr<buffer_t> m_backData;
public:
DBuffer(const std::size_t sizeMax) : m_sizeMax(sizeMax),
m_data(new buffer_t()),
m_backData(new buffer_t()) {}
virtual ~DBuffer() = default;
public:
const buffer_t& current() { return *m_data; }
void swap() { m_data.swap(m_backData); }
};
}
#endif
I just want to inherit from it, but :
#ifndef VIDEO_BUFFER_HPP
#define VIDEO_BUFFER_HPP
#include "dbuffer.hpp"
#include <deque>
namespace video {
template <typename T>
class VideoBuffer : public memory::DBuffer<std::deque, T> {
private:
static const unsigned int VIDEO_FPS_MAX = 60;
public:
VideoBuffer() : memory::DBuffer<std::deque, T>(VIDEO_FPS_MAX){}
~VideoBuffer() = default;
private:
void pop_to_back() {
m_backData->push_front(std::move(m_data->front()));
if (m_backData->size() > m_maxSize)
m_backData->pop_back();
m_data->pop_front();
}
#endif
But the only error is a not declared on every member that i tried to call from the base class.
Maybe i have a problem because some template type is not specified?
If somebody can explain why, i'll be thanks full.