Question.2
A ring buffer uses both type and non-type template parameters:
template<typename T, int Size>
class RingBuffer {
T buffer[Size];
int head = 0;
public:
void push(T val) {
buffer[head] = val;
head = (head + 1) % Size;
}
};
RingBuffer<int, 64> adc_buf;
RingBuffer<float, 10> avg_buf;Where is the buffer memory allocated?