#ifndef YAGE_MATH_MATRIX_HPP #define YAGE_MATH_MATRIX_HPP #include #include namespace yage { template class Matrix; template class Row { friend class Matrix; private: std::shared_ptr> parent_; int index_; public: Row(std::shared_ptr> parent, int index) : parent_(parent), index_(index) {} Type &operator[](int col) { return parent_->data_[index_*Cols+col]; } }; template class Matrix { private: std::vector data_; public: Matrix() : data_(Rows*Cols) {} Matrix(int rows, int cols) : data_(rows*cols) {} Row operator[](int row) { return Row(std::make_shared>(*this), row); } }; } // yage #endif