#pragma once #include "Container.hpp" template class Indexable : virtual public Container { public: T& operator[](unsigned index); const T& operator[](unsigned index) const; }; template T& Indexable::operator[](unsigned index) { if (index > this->size) { throw "Index out of range!"; } return this->arr[index]; } template const T& Indexable::operator[](unsigned index) const { if (index > this->size) { throw "Index out of range!"; } return this->arr[index]; }