Mercurial > hg > octave-nkf
diff liboctave/array/chMatrix.h @ 19508:6c9ea5be96bf
Change charMatrix to subclass charNDArray rather than be another Array<char>.
* chMatrix.h: both charMatrix and charNDArray are Array<char>, the first
being simply 2 dimensional. We change this so that charMatrix inherits from
charNDArray instead.
* chMatrix.cc: remove all constructors which are now inherited from
charNDArray.
* chNDArray.h, chNDArray.cc: implement all constructors here rather than
calling charMatrix. Remove matrix_value() since a charMatrix constructor is
now enough.
* pr-output.cc, octave-value/ov-ch-mat.h, octave-value/ov-str-mat.cc:
replace calls to charNDArray::matrix_value () with the charMatrix constructor.
author | Carnë Draug <carandraug@octave.org> |
---|---|
date | Fri, 24 Oct 2014 01:31:53 +0100 |
parents | ebb3ef964372 |
children | 8b4a24081e47 |
line wrap: on
line diff
--- a/liboctave/array/chMatrix.h +++ b/liboctave/array/chMatrix.h @@ -27,6 +27,7 @@ #include <string> #include "Array.h" +#include "chNDArray.h" #include "mx-defs.h" #include "mx-op-decl.h" @@ -34,35 +35,36 @@ class OCTAVE_API -charMatrix : public Array<char> +charMatrix : public charNDArray { friend class ComplexMatrix; public: - charMatrix (void) : Array<char> () { } + charMatrix (void) : charNDArray () { } charMatrix (octave_idx_type r, octave_idx_type c) - : Array<char> (dim_vector (r, c)) { } + : charNDArray (dim_vector (r, c)) { } charMatrix (octave_idx_type r, octave_idx_type c, char val) - : Array<char> (dim_vector (r, c), val) { } + : charNDArray (dim_vector (r, c), val) { } - charMatrix (const dim_vector& dv) : Array<char> (dv) { } + charMatrix (const dim_vector& dv) : charNDArray (dv) { } - charMatrix (const dim_vector& dv, char val) : Array<char> (dv, val) { } + charMatrix (const dim_vector& dv, char val) : charNDArray (dv, val) { } - charMatrix (const Array<char>& a) : Array<char> (a.as_matrix ()) { } + charMatrix (const Array<char>& a) : charNDArray (a.as_matrix ()) { } - charMatrix (const charMatrix& a) : Array<char> (a) { } + charMatrix (const charMatrix& a) : charNDArray (a) { } - charMatrix (char c); + charMatrix (char c) : charNDArray (c) {} - charMatrix (const char *s); + charMatrix (const char *s) : charNDArray (s) {} - charMatrix (const std::string& s); + charMatrix (const std::string& s) : charNDArray (s) {} - charMatrix (const string_vector& s, char fill_value = '\0'); + charMatrix (const string_vector& s, char fill_value = '\0') + : charNDArray (s, fill_value) {} charMatrix& operator = (const charMatrix& a) {