#pragma once #include #include #include #include #include "math/matrix/macro.h" namespace math::matrix { template class row_reference { private: row_reference(T (&h)[C]) : _handle(h) {} public: row_reference(row_reference const &) = delete; row_reference(row_reference &&) = default; template row_reference & operator=(row_reference const & other) { VECTOR_FOR_EACH_RANGE(i, C) { _handle[i] = other[i]; } return *this; } T const & operator[](size_t col) const { return _handle[col]; } T & operator[](size_t col) { return _handle[col]; } T const & at(size_t col) const { expects(col < C, std::out_of_range, "column index out of range"); return operator[](col); } T & at(size_t col) { expects(col < C, std::out_of_range, "column index out of range"); return operator[](col); } private: template friend class matrix; T (&_handle)[C]; }; } #include "math/matrix/undef.h"