diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-06-06 14:42:46 +0100 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-06-06 14:42:46 +0100 |
commit | d259d97d283bdf1d3b3d15916073c283ca2283e7 (patch) | |
tree | 1b618665a989237bb19ebc242342cf63512ddc3a /include/YAGE/Math | |
parent | d5b26e1a9428f7dd951dbf8ea08a5035620fa2e5 (diff) | |
download | YAGE-d259d97d283bdf1d3b3d15916073c283ca2283e7.tar.gz YAGE-d259d97d283bdf1d3b3d15916073c283ca2283e7.zip |
Need to fix Matrix to be assignable
Diffstat (limited to 'include/YAGE/Math')
-rw-r--r-- | include/YAGE/Math/matrix.hpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/YAGE/Math/matrix.hpp b/include/YAGE/Math/matrix.hpp index 76c90c16..2ada55eb 100644 --- a/include/YAGE/Math/matrix.hpp +++ b/include/YAGE/Math/matrix.hpp @@ -9,9 +9,11 @@ namespace yage template<int Rows, int Cols, class Type> class Matrix; +namespace detail +{ + template<int Rows, int Cols, class Type> class Row { - friend class Matrix<Rows, Cols, Type>; private: std::shared_ptr<Matrix<Rows, Cols, Type>> parent_; int index_; @@ -27,8 +29,11 @@ public: } }; +} // detail + template<int Rows=4, int Cols=4, class Type=double> class Matrix { + friend class detail::Row<Rows, Cols, Type>; private: std::vector<Type> data_; @@ -36,9 +41,9 @@ public: Matrix<Rows, Cols, Type>() : data_(Rows*Cols) {} Matrix<Rows, Cols, Type>(int rows, int cols) : data_(rows*cols) {} - Row<Rows, Cols, Type> operator[](int row) + detail::Row<Rows, Cols, Type> operator[](int row) { - return Row<Rows, Cols, Type>(std::make_shared<Matrix<Rows, Cols, Type>>(*this), row); + return detail::Row<Rows, Cols, Type>(std::make_shared<Matrix<Rows, Cols, Type>>(*this), row); } }; |