From db4d656061145a072d2deb8f976cb8537e45e93b Mon Sep 17 00:00:00 2001 From: espie Date: Thu, 27 Apr 2017 20:28:50 +0000 Subject: [PATCH] more thorough, is this enough for modern C++ ? --- geo/gpstk/patches/patch-src_Matrix_hpp | 118 ++++++++++++++++++++++++- geo/gpstk/patches/patch-src_Vector_hpp | 49 +++++++++- 2 files changed, 161 insertions(+), 6 deletions(-) diff --git a/geo/gpstk/patches/patch-src_Matrix_hpp b/geo/gpstk/patches/patch-src_Matrix_hpp index c8899b0848f..e3bc2f2315e 100644 --- a/geo/gpstk/patches/patch-src_Matrix_hpp +++ b/geo/gpstk/patches/patch-src_Matrix_hpp @@ -1,6 +1,94 @@ -$OpenBSD: patch-src_Matrix_hpp,v 1.1 2017/04/27 20:17:24 espie Exp $ +$OpenBSD: patch-src_Matrix_hpp,v 1.2 2017/04/27 20:28:50 espie Exp $ --- src/Matrix.hpp.orig Thu Apr 27 22:13:48 2017 -+++ src/Matrix.hpp Thu Apr 27 22:14:08 2017 ++++ src/Matrix.hpp Thu Apr 27 22:25:47 2017 +@@ -187,14 +187,14 @@ namespace gpstk + * @warning be careful that array is as large as the matrix is! + */ + inline Matrix& operator=(const T* array) +- { return assignFrom(array); } ++ { return this->assignFrom(array); } + /// Assigns the contents of this matrix to those in array in column + /// major order. + inline Matrix& operator=(const std::valarray array) +- { return assignFrom(array); } ++ { return this->assignFrom(array); } + /// Assigns all elements of the matrix to \c t. + inline Matrix& operator=(const T t) +- { return assignFrom(t); } ++ { return this->assignFrom(t); } + /// Copies the other matrix. + inline Matrix& operator=(const Matrix& mat) + { v = mat.v; r = mat.r; c = mat.c; s = mat.s; return *this; } +@@ -206,12 +206,12 @@ namespace gpstk + r=mat.rows(); + c=mat.cols(); + s=mat.size(); +- return assignFrom(mat); ++ return this->assignFrom(mat); + } + /// Copies from any vector. + template + inline Matrix& operator=(const ConstVectorBase& mat) +- { return assignFrom(mat); } ++ { return this->assignFrom(mat); } + + private: + /// the matrix stored in column major order +@@ -263,22 +263,22 @@ namespace gpstk + /// Copies from x to (*this). + template + MatrixSlice& operator=(const ConstMatrixBase& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// Copies from x to (*this). + template + MatrixSlice& operator=(const ConstVectorBase& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// Copies from x to (*this). + MatrixSlice& operator=(const std::valarray& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// Copies from x to (*this). + MatrixSlice& operator=(const T x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// Copies from x to (*this). + MatrixSlice& operator=(const T* x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// returns the size of this slice + size_t size() const { return s; } +@@ -414,21 +414,21 @@ namespace gpstk + /// assigns this column to x + template + MatrixColSlice& operator=(const ConstMatrixBase& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// assigns this column to x + template + MatrixColSlice& operator=(const ConstVectorBase& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// assigns this column to x + MatrixColSlice& operator=(const std::valarray& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// assigns this column to x + MatrixColSlice& operator=(const T x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// assigns this column to x + MatrixColSlice& operator=(const T* x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// returns the i'th element of the column, non-const + T& operator[] (size_t i) @@ -560,7 +560,7 @@ namespace gpstk /// makes a slice of row \c row from the matrix. MatrixRowSlice(Matrix& mat, size_t row) @@ -10,7 +98,7 @@ $OpenBSD: patch-src_Matrix_hpp,v 1.1 2017/04/27 20:17:24 espie Exp $ /// makes a slice of row \c row from the matrix, slicing it by \c s. MatrixRowSlice(Matrix& mat, size_t row, -@@ -568,7 +568,7 @@ namespace gpstk +@@ -568,26 +568,26 @@ namespace gpstk : m(&mat), r(row), cSlice(s) { // decide if the input is reasonable @@ -19,3 +107,27 @@ $OpenBSD: patch-src_Matrix_hpp,v 1.1 2017/04/27 20:17:24 espie Exp $ } /// assigns this row to x. + template + MatrixRowSlice& operator=(const ConstMatrixBase& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// assigns this row to x. + template + MatrixRowSlice& operator=(const ConstVectorBase& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// assigns this row to x. + MatrixRowSlice& operator=(const std::valarray& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// assigns this row to x. + MatrixRowSlice& operator=(const T x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// assigns this row to x. + MatrixRowSlice& operator=(const T* x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// returns the j'th element of the slice, non-const + T& operator[] (size_t j) diff --git a/geo/gpstk/patches/patch-src_Vector_hpp b/geo/gpstk/patches/patch-src_Vector_hpp index b78f7714570..4e096a324da 100644 --- a/geo/gpstk/patches/patch-src_Vector_hpp +++ b/geo/gpstk/patches/patch-src_Vector_hpp @@ -1,6 +1,6 @@ -$OpenBSD: patch-src_Vector_hpp,v 1.1 2017/04/27 20:17:24 espie Exp $ +$OpenBSD: patch-src_Vector_hpp,v 1.2 2017/04/27 20:28:50 espie Exp $ --- src/Vector.hpp.orig Thu Apr 27 22:06:42 2017 -+++ src/Vector.hpp Thu Apr 27 22:13:29 2017 ++++ src/Vector.hpp Thu Apr 27 22:24:33 2017 @@ -87,7 +87,7 @@ namespace gpstk VectorException e("Vector(size_t, const T) failed to allocate"); GPSTK_THROW(e); @@ -46,7 +46,7 @@ $OpenBSD: patch-src_Vector_hpp,v 1.1 2017/04/27 20:17:24 espie Exp $ /// STL size size_t size() const {return s; } /// STL max_size -@@ -197,7 +197,7 @@ namespace gpstk +@@ -197,22 +197,22 @@ namespace gpstk /// *this will be resized if it isn't as large as x. Vector& operator=(const Vector& x) @@ -55,3 +55,46 @@ $OpenBSD: patch-src_Vector_hpp,v 1.1 2017/04/27 20:17:24 espie Exp $ /// *this will be resized if it isn't as large as x. template + Vector& operator=(const ConstVectorBase& x) +- { resize(x.size()); return assignFrom(x); } ++ { resize(x.size()); return this->assignFrom(x); } + + /// *this will be resized if it isn't as large as x. + Vector& operator=(const std::valarray& x) +- { resize(x.size()); return assignFrom(x); } ++ { resize(x.size()); return this->assignFrom(x); } + /// Only (*this).size() elements will be assigned. + Vector& operator=(const T x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + /// Only (*this).size() elements will be assigned. + Vector& operator=(const T* x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// *this will be cleared and resized as necessary + inline Vector& operator=(const std::vector& x) +@@ -337,19 +337,19 @@ namespace gpstk + /// Assign the elements of this slice from another vector. + template + VectorSlice& operator=(const ConstVectorBase& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// Assign the elements of this slice from a valarray. + VectorSlice& operator=(const std::valarray& x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// Assign all the elements of this slice to x. + VectorSlice& operator=(const T x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// Assign (*this).size() elements from x to (*this). + VectorSlice& operator=(const T* x) +- { return assignFrom(x); } ++ { return this->assignFrom(x); } + + /// Returns the modifiable i'th element of the slice. + T& operator[] (size_t i)