rendered paste body#define BUFF_ENT_MAX 10using namespace std;template <class T>class RingBuf {public: RingBuf(int Gr = BUFF_ENT_MAX); RingBuf(const RingBuf& other); ~RingBuf(); RingBuf& operator=(const RingBuf& other); T& operator[](int i); void store(T& toAdd); int find(T& toFind);private: int size; T* theData;};/* direkt folgend: Funktionsimplementierung */template <class T>RingBuf<T>::RingBuf(int Gr) { // erstellt RingBuf mit Daten vom Typ T if(Gr < 1 || Gr > 100) Gr = BUFF_ENT_MAX; size = Gr; theData = new T [size]; for(int i=0; i<size; i++) theData[i] = 0;}template <class T>RingBuf<T>::~RingBuf() { delete[] theData;}template <class T>RingBuf<T>::RingBuf(const RingBuf<T>& Other) { size = Other.size; theData = new T[size]; for(int i = 0; i < size; i++) theData[i] = Other.theData[i]; }template <class T>RingBuf<T>& RingBuf<T>::operator=(const RingBuf<T>& Other) { delete[] theData; theData = new T[Other.size]; size = Other.size; for(int i = 0; i < size; i++) theData[i] = Other.theData[i]; return *this;}template <class T>T& RingBuf<T>::operator[](int i) { if(i < size && i >= 0) return theData[i]; else { terminate(); }}template <class T>void RingBuf<T>::store(T& toAdd) { // fuegt Daten in Puffer (am Ende) ein for(int i = size - 1; i >= 1; i--) { theData[i-1] = theData[i]; } theData[0] = toAdd;}template <class T>int RingBuf<T>::find(T& toFind) { // sucht Daten im Puffer int foundAt = -1; for(int i = 0; i < size && foundAt != -1; i++) { if(theData[i] == toFind) foundAt = i; } return foundAt;}-------------------------------------------------------------------------#include <iostream>#include <iomanip>#include "templateT.h"using namespace std;int main() { RingBuf<int> RInt(20); int y = 5; //int i = RInt[4]; RInt.store(y); cout << "Hallo, du:: \n" << RInt[0] << endl;}