more thorough, is this enough for modern C++ ?

This commit is contained in:
espie 2017-04-27 20:28:50 +00:00
parent 255ae4fbbb
commit db4d656061
2 changed files with 161 additions and 6 deletions

View File

@ -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<T> 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 <class BaseClass>
inline Matrix& operator=(const ConstVectorBase<T, BaseClass>& 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 <class V>
MatrixSlice& operator=(const ConstMatrixBase<T, V>& x)
- { return assignFrom(x); }
+ { return this->assignFrom(x); }
/// Copies from x to (*this).
template <class V>
MatrixSlice& operator=(const ConstVectorBase<T, V>& x)
- { return assignFrom(x); }
+ { return this->assignFrom(x); }
/// Copies from x to (*this).
MatrixSlice& operator=(const std::valarray<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); }
/// 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 <class V>
MatrixColSlice& operator=(const ConstMatrixBase<T, V>& x)
- { return assignFrom(x); }
+ { return this->assignFrom(x); }
/// assigns this column to x
template <class V>
MatrixColSlice& operator=(const ConstVectorBase<T, V>& x)
- { return assignFrom(x); }
+ { return this->assignFrom(x); }
/// assigns this column to x
MatrixColSlice& operator=(const std::valarray<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); }
/// 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<T>& 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<T>& 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 <class V>
MatrixRowSlice& operator=(const ConstMatrixBase<T, V>& x)
- { return assignFrom(x); }
+ { return this->assignFrom(x); }
/// assigns this row to x.
template <class V>
MatrixRowSlice& operator=(const ConstVectorBase<T, V>& x)
- { return assignFrom(x); }
+ { return this->assignFrom(x); }
/// assigns this row to x.
MatrixRowSlice& operator=(const std::valarray<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); }
/// 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)

View File

@ -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<T>(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 <class E>
Vector& operator=(const ConstVectorBase<T, E>& 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<T>& 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<T>& x)
@@ -337,19 +337,19 @@ namespace gpstk
/// Assign the elements of this slice from another vector.
template <class V>
VectorSlice& operator=(const ConstVectorBase<T, V>& x)
- { return assignFrom(x); }
+ { return this->assignFrom(x); }
/// Assign the elements of this slice from a valarray.
VectorSlice& operator=(const std::valarray<T>& 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)