Mercurial > jwe > octave
changeset 27026:fc256e9d882e
use default ctors, dtors, and assignment ops in Matrix, intNDArray, and Cell
* Cell.h, CDiagMatrix.h, CMatrix.h, PermMatrix.h, Range.h,
boolMatrix.h, chMatrix.h, dDiagMatrix.h, dMatrix.h, fCDiagMatrix.h,
fCMatrix.h, fDiagMatrix.h, fMatrix.h, intNDArray.h:
Explicitly declare default constructor, copy constructor, assignment
operator, and destructor as "default".
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 03 Apr 2019 16:03:16 +0000 |
parents | 2e4e42ba7016 |
children | 0dd80c6d2e3c |
files | libinterp/corefcn/Cell.h liboctave/array/CDiagMatrix.h liboctave/array/CMatrix.h liboctave/array/PermMatrix.h liboctave/array/Range.h liboctave/array/boolMatrix.h liboctave/array/chMatrix.h liboctave/array/dDiagMatrix.h liboctave/array/dMatrix.h liboctave/array/fCDiagMatrix.h liboctave/array/fCMatrix.h liboctave/array/fDiagMatrix.h liboctave/array/fMatrix.h liboctave/array/intNDArray.h |
diffstat | 14 files changed, 96 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/Cell.h Wed Apr 03 13:24:03 2019 +0000 +++ b/libinterp/corefcn/Cell.h Wed Apr 03 16:03:16 2019 +0000 @@ -40,8 +40,13 @@ { public: - Cell (void) - : Array<octave_value> (dim_vector (0, 0)) { } + Cell (void) = default; + + Cell (const Cell& c) = default; + + Cell& operator = (const Cell& c) = default; + + ~Cell (void) = default; Cell (const octave_value& val) : Array<octave_value> (dim_vector (1, 1), val) { } @@ -87,9 +92,6 @@ Cell (const dim_vector& dv, const string_vector& sv, bool trim = false); - Cell (const Cell& c) - : Array<octave_value> (c) { } - bool iscellstr (void) const; Array<std::string> cellstr_value (void) const;
--- a/liboctave/array/CDiagMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/CDiagMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -45,7 +45,13 @@ typedef Complex complex_elt_type; typedef Complex element_type; - ComplexDiagMatrix (void) : MDiagArray2<Complex> () { } + ComplexDiagMatrix (void) = default; + + ComplexDiagMatrix (const ComplexDiagMatrix& a) = default; + + ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) = default; + + ~ComplexDiagMatrix (void) = default; ComplexDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<Complex> (r, c) { } @@ -68,19 +74,10 @@ ComplexDiagMatrix (const MDiagArray2<Complex>& a) : MDiagArray2<Complex> (a) { } - ComplexDiagMatrix (const ComplexDiagMatrix& a) - : MDiagArray2<Complex> (a) { } - template <typename U> ComplexDiagMatrix (const DiagArray2<U>& a) : MDiagArray2<Complex> (a) { } - ComplexDiagMatrix& operator = (const ComplexDiagMatrix& a) - { - MDiagArray2<Complex>::operator = (a); - return *this; - } - bool operator == (const ComplexDiagMatrix& a) const; bool operator != (const ComplexDiagMatrix& a) const;
--- a/liboctave/array/CMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/CMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -57,7 +57,13 @@ typedef void (*solve_singularity_handler) (double rcon); - ComplexMatrix (void) : ComplexNDArray () { } + ComplexMatrix (void) = default; + + ComplexMatrix (const ComplexMatrix& a) = default; + + ComplexMatrix& operator = (const ComplexMatrix& a) = default; + + ~ComplexMatrix (void) = default; ComplexMatrix (octave_idx_type r, octave_idx_type c) : ComplexNDArray (dim_vector (r, c)) { } @@ -70,8 +76,6 @@ ComplexMatrix (const dim_vector& dv, const Complex& val) : ComplexNDArray (dv.redim (2), val) { } - ComplexMatrix (const ComplexMatrix& a) : ComplexNDArray (a) { } - template <typename U> ComplexMatrix (const MArray<U>& a) : ComplexNDArray (a.as_matrix ()) { }
--- a/liboctave/array/PermMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/PermMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -35,14 +35,18 @@ { public: - PermMatrix (void) : Array<octave_idx_type> () { } + PermMatrix (void) = default; + + PermMatrix (const PermMatrix& m) = default; + + PermMatrix& operator = (const PermMatrix& m) = default; + + ~PermMatrix (void) = default; PermMatrix (octave_idx_type n); PermMatrix (const Array<octave_idx_type>& p, bool colp, bool check = true); - PermMatrix (const PermMatrix& m) : Array<octave_idx_type> (m) { } - PermMatrix (const idx_vector& idx, bool colp, octave_idx_type n = 0); octave_idx_type dim1 (void) const
--- a/liboctave/array/Range.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/Range.h Wed Apr 03 16:03:16 2019 +0000 @@ -39,9 +39,11 @@ Range (void) : rng_base (0), rng_limit (0), rng_inc (0), rng_numel (0), cache (1, 0) { } - Range (const Range& r) - : rng_base (r.rng_base), rng_limit (r.rng_limit), rng_inc (r.rng_inc), - rng_numel (r.rng_numel), cache (r.cache) { } + Range (const Range& r) = default; + + Range& operator = (const Range& r) = default; + + ~Range (void) = default; Range (double b, double l) : rng_base (b), rng_limit (l), rng_inc (1),
--- a/liboctave/array/boolMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/boolMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -37,7 +37,13 @@ { public: - boolMatrix (void) : boolNDArray () { } + boolMatrix (void) = default; + + boolMatrix (const boolMatrix& a) = default; + + boolMatrix& operator = (const boolMatrix& a) = default; + + ~boolMatrix (void) = default; boolMatrix (octave_idx_type r, octave_idx_type c) : boolNDArray (dim_vector (r, c)) { } @@ -52,8 +58,6 @@ boolMatrix (const Array<bool>& a) : boolNDArray (a.as_matrix ()) { } - boolMatrix (const boolMatrix& a) : boolNDArray (a) { } - bool operator == (const boolMatrix& a) const; bool operator != (const boolMatrix& a) const;
--- a/liboctave/array/chMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/chMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -42,7 +42,13 @@ public: - charMatrix (void) : charNDArray () { } + charMatrix (void) = default; + + charMatrix (const charMatrix& a) = default; + + charMatrix& operator = (const charMatrix& a) = default; + + ~charMatrix (void) = default; charMatrix (octave_idx_type r, octave_idx_type c) : charNDArray (dim_vector (r, c)) { } @@ -57,8 +63,6 @@ charMatrix (const Array<char>& a) : charNDArray (a.as_matrix ()) { } - charMatrix (const charMatrix& a) : charNDArray (a) { } - charMatrix (char c) : charNDArray (c) { } charMatrix (const char *s) : charNDArray (s) { }
--- a/liboctave/array/dDiagMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/dDiagMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -39,7 +39,13 @@ typedef Matrix full_matrix_type; - DiagMatrix (void) : MDiagArray2<double> () { } + DiagMatrix (void) = default; + + DiagMatrix (const DiagMatrix& a) = default; + + DiagMatrix& operator = (const DiagMatrix& a) = default; + + ~DiagMatrix (void) = default; DiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<double> (r, c) { } @@ -47,8 +53,6 @@ DiagMatrix (octave_idx_type r, octave_idx_type c, double val) : MDiagArray2<double> (r, c, val) { } - DiagMatrix (const DiagMatrix& a) : MDiagArray2<double> (a) { } - DiagMatrix (const MDiagArray2<double>& a) : MDiagArray2<double> (a) { } template <typename U> @@ -59,12 +63,6 @@ DiagMatrix (const Array<double>& a, octave_idx_type r, octave_idx_type c) : MDiagArray2<double> (a, r, c) { } - DiagMatrix& operator = (const DiagMatrix& a) - { - MDiagArray2<double>::operator = (a); - return *this; - } - bool operator == (const DiagMatrix& a) const; bool operator != (const DiagMatrix& a) const;
--- a/liboctave/array/dMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/dMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -56,7 +56,13 @@ typedef void (*solve_singularity_handler) (double rcon); - Matrix (void) : NDArray () { } + Matrix (void) = default; + + Matrix (const Matrix& a) = default; + + Matrix& operator = (const Matrix& a) = default; + + ~Matrix (void) = default; Matrix (octave_idx_type r, octave_idx_type c) : NDArray (dim_vector (r, c)) { } @@ -69,8 +75,6 @@ Matrix (const dim_vector& dv, double val) : NDArray (dv.redim (2), val) { } - Matrix (const Matrix& a) : NDArray (a) { } - template <typename U> Matrix (const MArray<U>& a) : NDArray (a.as_matrix ()) { }
--- a/liboctave/array/fCDiagMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/fCDiagMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -45,7 +45,13 @@ typedef FloatComplex complex_elt_type; typedef FloatComplex element_type; - FloatComplexDiagMatrix (void) : MDiagArray2<FloatComplex> () { } + FloatComplexDiagMatrix (void) = default; + + FloatComplexDiagMatrix (const FloatComplexDiagMatrix& a) = default; + + FloatComplexDiagMatrix& operator = (const FloatComplexDiagMatrix& a) = default; + + ~FloatComplexDiagMatrix (void) = default; FloatComplexDiagMatrix (octave_idx_type r, octave_idx_type c) @@ -70,19 +76,10 @@ FloatComplexDiagMatrix (const MDiagArray2<FloatComplex>& a) : MDiagArray2<FloatComplex> (a) { } - FloatComplexDiagMatrix (const FloatComplexDiagMatrix& a) - : MDiagArray2<FloatComplex> (a) { } - template <typename U> FloatComplexDiagMatrix (const DiagArray2<U>& a) : MDiagArray2<FloatComplex> (a) { } - FloatComplexDiagMatrix& operator = (const FloatComplexDiagMatrix& a) - { - MDiagArray2<FloatComplex>::operator = (a); - return *this; - } - bool operator == (const FloatComplexDiagMatrix& a) const; bool operator != (const FloatComplexDiagMatrix& a) const;
--- a/liboctave/array/fCMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/fCMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -57,7 +57,13 @@ typedef void (*solve_singularity_handler) (float rcon); - FloatComplexMatrix (void) : FloatComplexNDArray () { } + FloatComplexMatrix (void) = default; + + FloatComplexMatrix (const FloatComplexMatrix& a) = default; + + FloatComplexMatrix& operator = (const FloatComplexMatrix& a) = default; + + ~FloatComplexMatrix (void) = default; FloatComplexMatrix (octave_idx_type r, octave_idx_type c) : FloatComplexNDArray (dim_vector (r, c)) { } @@ -72,9 +78,6 @@ FloatComplexMatrix (const dim_vector& dv, const FloatComplex& val) : FloatComplexNDArray (dv.redim (2), val) { } - FloatComplexMatrix (const FloatComplexMatrix& a) - : FloatComplexNDArray (a) { } - template <typename U> FloatComplexMatrix (const MArray<U>& a) : FloatComplexNDArray (a.as_matrix ()) { }
--- a/liboctave/array/fDiagMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/fDiagMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -39,7 +39,13 @@ typedef FloatMatrix full_matrix_type; - FloatDiagMatrix (void) : MDiagArray2<float> () { } + FloatDiagMatrix (void) = default; + + FloatDiagMatrix (const FloatDiagMatrix& a) = default; + + FloatDiagMatrix& operator = (const FloatDiagMatrix& a) = default; + + ~FloatDiagMatrix (void) = default; FloatDiagMatrix (octave_idx_type r, octave_idx_type c) : MDiagArray2<float> (r, c) { } @@ -47,8 +53,6 @@ FloatDiagMatrix (octave_idx_type r, octave_idx_type c, float val) : MDiagArray2<float> (r, c, val) { } - FloatDiagMatrix (const FloatDiagMatrix& a) : MDiagArray2<float> (a) { } - FloatDiagMatrix (const MDiagArray2<float>& a) : MDiagArray2<float> (a) { } template <typename U> @@ -59,12 +63,6 @@ FloatDiagMatrix (const Array<float>& a, octave_idx_type r, octave_idx_type c) : MDiagArray2<float> (a, r, c) { } - FloatDiagMatrix& operator = (const FloatDiagMatrix& a) - { - MDiagArray2<float>::operator = (a); - return *this; - } - bool operator == (const FloatDiagMatrix& a) const; bool operator != (const FloatDiagMatrix& a) const;
--- a/liboctave/array/fMatrix.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/fMatrix.h Wed Apr 03 16:03:16 2019 +0000 @@ -56,7 +56,13 @@ typedef void (*solve_singularity_handler) (float rcon); - FloatMatrix (void) : FloatNDArray () { } + FloatMatrix (void) = default; + + FloatMatrix (const FloatMatrix& a) = default; + + FloatMatrix& operator = (const FloatMatrix& a) = default; + + ~FloatMatrix (void) = default; FloatMatrix (octave_idx_type r, octave_idx_type c) : FloatNDArray (dim_vector (r, c)) { } @@ -69,8 +75,6 @@ FloatMatrix (const dim_vector& dv, float val) : FloatNDArray (dv.redim (2), val) { } - FloatMatrix (const FloatMatrix& a) : FloatNDArray (a) { } - template <typename U> FloatMatrix (const MArray<U>& a) : FloatNDArray (a.as_matrix ()) { }
--- a/liboctave/array/intNDArray.h Wed Apr 03 13:24:03 2019 +0000 +++ b/liboctave/array/intNDArray.h Wed Apr 03 16:03:16 2019 +0000 @@ -38,7 +38,13 @@ using typename MArray<T>::element_type; - intNDArray (void) : MArray<T> () { } + intNDArray (void) = default; + + intNDArray (const intNDArray<T>& a) = default; + + intNDArray& operator = (const intNDArray<T>& a) = default; + + ~intNDArray (void) = default; intNDArray (T val) : MArray<T> (dim_vector (1, 1), val) { } @@ -56,12 +62,6 @@ template <typename U> intNDArray (const intNDArray<U>& a) : MArray<T> (a) { } - intNDArray& operator = (const intNDArray<T>& a) - { - MArray<T>::operator = (a); - return *this; - } - boolNDArray operator ! (void) const; bool any_element_is_nan (void) const { return false; }