Custom Ring Buffer Class
Implement a templated ring buffer class in C++ that stores elements in a fixed-size circular buffer. The class must support push, pop, size, and full/empty checks.
Constraints
- Template parameter N.
- Internal array of N elements.
- head/tail indices.
- push returns false on full.
- pop returns false on empty.
- No dynamic allocation.
1template<typename T, int N>2class Ring {3public:4 bool push(const T& v);5 bool pop(T& v);6 int size() const;7};