Mercurial > hg > octave-lyh
diff liboctave/Array2.h @ 3473:64f8babb7b3d
[project @ 2000-01-25 09:44:15 by jwe]
author | jwe |
---|---|
date | Tue, 25 Jan 2000 09:44:17 +0000 |
parents | 9c509e1cbf49 |
children | 17261f602206 |
line wrap: on
line diff
--- a/liboctave/Array2.h +++ b/liboctave/Array2.h @@ -29,6 +29,8 @@ #endif #include <cassert> +#include <climits> +#include <cmath> #include <cstdlib> #include "Array.h" @@ -41,9 +43,13 @@ template <class T> class Array2 : public Array<T> { +private: + + int get_size (int r, int c) const; + protected: - Array2 (T *d, int n, int m) : Array<T> (d, n*m) + Array2 (T *d, int n, int m) : Array<T> (d, get_size (n, m)) { d1 = n; d2 = m; @@ -66,14 +72,14 @@ set_max_indices (2); } - Array2 (int n, int m) : Array<T> (n*m) + Array2 (int n, int m) : Array<T> (get_size (n, m)) { d1 = n; d2 = m; set_max_indices (2); } - Array2 (int n, int m, const T& val) : Array<T> (n*m, val) + Array2 (int n, int m, const T& val) : Array<T> (get_size (n, m), val) { d1 = n; d2 = m;