changeset 14616:13cc11418393

improve handling of default resize fill value for arrays * Array.cc (Array<T>::resize_fill_value): Return T, not const T&. * Array.h (Array<T>::resize_fill_value): Now virtual member function instead of static. (Array<T>::resize1 (octave_idx_type)): New function. (Array<T>::resize1 (octave_idx_type, const T&)): Eliminate default value for second arg. (Array<T>::resize (octave_idx_type, octave_idx_type)): New function. (Array<T>::resize (octave_idx_type, octave_idx_type, const T&)): Eliminate default value for third arg. (Array<T>::resize (const dim_vector&)): New function. (Array<T>::resize (const dim_vector&, const T&)): New function. (Array<T>::resize2 (octave_idx_type, octave_idx_type)): New function. (Array<T>::resize2 (octave_idx_type, octave_idx_type, const T&)): Eliminate default value for third arg. (Array<T>::index (const idx_vector&, bool) const): New function. (Array<T>::index (const idx_vector&, bool, const T&) const): Eliminate default value for third arg. (Array<T>::index (const idx_vector&, const idx_vector&, bool) const): New function. (Array<T>::index (const idx_vector&, const idx_vector&, bool, const T&) const): Eliminate default value for third arg. (Array<T>::index (const Array<idx_vector>&, bool) const): New function. (Array<T>::index (const Array<idx_vector>&, const T&) const): Eliminate default value for third arg. (Array<T>::assign (const idx_vector&, const Array<T>&)): New function. (Array<T>::assign (const idx_vector&, const Array<T>&, const T&)): Eliminate default value for third arg. (Array<T>::assign (const idx_vector&, const idx_vector&, const Array<T>&)): New function. (Array<T>::assign (const idx_vector&, const idx_vector&, const Array<T>&, const T&)): Eliminate default value for third arg. (Array<T>::assign (const Array<idx_vector>&, const Array<T>&)): New function. (Array<T>::assign (const Array<idx_vector>&, const Array<T>&, const T&)): Eliminate default value for third arg. * DiagArray2.h (DiagArray2<T>::resize (octave_idx_type, octave_idx_type)): New function. (DiagArray2<T>::resize (octave_idx_type, octave_idx_type, const T&)): Eliminate default value for third arg. * CColVector.h (ComplexColumnVector::resize): Use Complex (0) as default value instead of Array<Complex>::resize_fill_value (). * CMatrix.h (ComplexMatrix::resize): Use Complex (0) as default value instead of Array<Complex>::resize_fill_value (). (ComplexMatrix::resize_fill_value): Delete. * CNDArray.h (ComplexNDArray::resize_fill_value): Delete. * CRowVector.h (ComplexRowVector::resize): Use Complex (0) as default value instead of Array<Complex>::resize_fill_value (). * boolMatrix.h (boolMatrix::resize): Use false as default value instead of resize_fill_value (). (boolMatrix::resize_fill_value): Delete. * boolNDArray.h (boolNDArray::resize_fill_value): Delete. * chMatrix.h (charMatrix::resize): Use 0 as default value instead of resize_fill_value. (charMatrix::resize_fill_value): Delete. * chNDArray.h (charNDArray::resize_fill_value): Delete. * dColVector.h (ColumnVector::resize): Use 0 as default value instead of Array<double>::resize_fill_value (). * dMatrix.h (Matrix::resize): Use 0 as default value instead of resize_fill_value (). (Matrix::resize_fill_value): Delete. * dNDArray.h (NDArray::resize_fill_value): Delete. * dRowVector.h (RowVector::resize): Use 0 as default value instead of Array<double>::resize_fill_value (). * fCColVector.h (FloatComplexColumnVector::resize): Use FloatComplex (0) as default value instead of Array<FloatComplex>::resize_fill_value (). * fCMatrix.h (FloatComplexMatrix::resize): Use FloatComplex (0) as default value instead of resize_fill_value ()). FloatCmplexMatrix::resize_fill_value): Delete. * fCNDArray.h (FloatComplexNDArray::resize_fill_value): Delete. * fCRowVector.h (FloatComplexRowVector::resize): Use FloatComplex (0) as default value instead of Array<FloatComplex>::resize_fill_value (). * fColVector.h (FloatColumnVector::resize): Use 0 as default value instead of Array<float>::resize_fill_value (). * fMatrix.h (FloatMatrix::resize): Use 0 as default value instead of resize_fill_value (). * fMatrix.h (FloatMatrix::resize_fill_value): Delete. * fNDArray.h (FloatNDArray::resize_fill_value): Delete. * fRowVector.h (FloatRowVector::resize): Use 0 as default value instead of Array<float>::resize_fill_value (). * intNDArray.h (intNDArray<T>::resize_fill_value): Delete. * str-vec.h (string_vector::resize): Use std::string as default value instead of resize_fill_value (). * Cell.cc, Cell.h (Cell::Cell, Cell::assign, Cell::index): Use Matrix () as default value instead of resize_fill_value (). (Cell::resize_fill_value): No longer static. * oct-map.cc (octave_map::resize, octave_map::assign, Octave_map::resize, Octave_map::assign): Use Matrix () as default value instead of Cell::resize_fill_value. * oct-obj.h (octave_value_list::resize): Use octave_value () instead of Array<octave_value>::resize_fill_value (). * ov-complex.cc (octave_complex::resize): Use Complex (0) for fill value instead of ComplexNDArray::resize_fill_value (). * ov-float.cc (octave_float_scalar::resize): Use 0 for fill value instead of NDArray::resize_fill_value (). * ov-flt-complex.cc (octave_float_complex_scalar::resize): Use Complex (0) for fill value instead of ComplexNDArray::resize_fill_value (). * ov-range.cc (octave_range::resize): Use 0 for fill value instead of NDArray::resize_fill_value (). * ov-scalar.cc (octave_scalar::resize): Use 0 for fill value instead of NDArray::resize_fill_value (). * ov-str-mat.cc (octave_char_matrix_str::resize): Use 0 for fill value instead of charNDArray::resize_fill_value ().
author John W. Eaton <jwe@octave.org>
date Thu, 10 May 2012 16:31:02 -0400
parents 88e67d58b06b
children 8ffb01c3a27a
files liboctave/Array.cc liboctave/Array.h liboctave/CColVector.h liboctave/CMatrix.h liboctave/CNDArray.h liboctave/CRowVector.h liboctave/DiagArray2.h liboctave/boolMatrix.h liboctave/boolNDArray.h liboctave/chMatrix.h liboctave/chNDArray.h liboctave/dColVector.h liboctave/dMatrix.h liboctave/dNDArray.h liboctave/dRowVector.h liboctave/fCColVector.h liboctave/fCMatrix.h liboctave/fCNDArray.h liboctave/fCRowVector.h liboctave/fColVector.h liboctave/fMatrix.h liboctave/fNDArray.h liboctave/fRowVector.h liboctave/intNDArray.h liboctave/str-vec.h src/Cell.cc src/Cell.h src/oct-map.cc src/oct-obj.h src/ov-complex.cc src/ov-float.cc src/ov-flt-complex.cc src/ov-range.cc src/ov-scalar.cc src/ov-str-mat.cc
diffstat 35 files changed, 92 insertions(+), 106 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array.cc	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/Array.cc	Thu May 10 16:31:02 2012 -0400
@@ -884,7 +884,8 @@
 // The default fill value.  Override if you want a different one.
 
 template <class T>
-const T& Array<T>::resize_fill_value ()
+T
+Array<T>::resize_fill_value (void) const
 {
   static T zero = T ();
   return zero;
--- a/liboctave/Array.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/Array.h	Thu May 10 16:31:02 2012 -0400
@@ -450,46 +450,69 @@
 
   Array<T> index (const Array<idx_vector>& ia) const;
 
-  static const T& resize_fill_value ();
+  virtual T resize_fill_value (void) const;
 
   // Resizing (with fill).
 
-  void resize1 (octave_idx_type n, const T& rfv = resize_fill_value ());
+  void resize1 (octave_idx_type n, const T& rfv);
+  void resize1 (octave_idx_type n) { resize1 (n, resize_fill_value ()); }
 
-  void resize (octave_idx_type n) GCC_ATTR_DEPRECATED
-    { resize1 (n); }
+  void resize (octave_idx_type n) GCC_ATTR_DEPRECATED { resize1 (n); }
 
-  void resize (octave_idx_type nr, octave_idx_type nc,
-               const T& rfv = resize_fill_value ()) GCC_ATTR_DEPRECATED
+  void resize (octave_idx_type nr, octave_idx_type nc, const T& rfv) GCC_ATTR_DEPRECATED
   {
     resize2 (nr, nc, rfv);
   }
 
-  void resize (const dim_vector& dv, const T& rfv = resize_fill_value ());
+  void resize (octave_idx_type nr, octave_idx_type nc) GCC_ATTR_DEPRECATED
+  {
+    resize2 (nr, nc, resize_fill_value ());
+  }
+
+  void resize (const dim_vector& dv, const T& rfv);
+  void resize (const dim_vector& dv) { resize (dv, resize_fill_value ()); }
 
   // Indexing with possible resizing and fill
   // FIXME -- this is really a corner case, that should better be
   // handled directly in liboctinterp.
 
-  Array<T> index (const idx_vector& i, bool resize_ok,
-                  const T& rfv = resize_fill_value ()) const;
+  Array<T> index (const idx_vector& i, bool resize_ok, const T& rfv) const;
+  Array<T> index (const idx_vector& i, bool resize_ok) const
+  {
+    return index (i, resize_ok, resize_fill_value ());
+  }
 
-  Array<T> index (const idx_vector& i, const idx_vector& j,
-                  bool resize_ok, const T& rfv = resize_fill_value ()) const;
+  Array<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok, const T& rfv) const;
+  Array<T> index (const idx_vector& i, const idx_vector& j, bool resize_ok) const
+  {
+    return index (i, j, resize_ok, resize_fill_value ());
+  }
 
-  Array<T> index (const Array<idx_vector>& ia,
-                  bool resize_ok, const T& rfv = resize_fill_value ()) const;
+  Array<T> index (const Array<idx_vector>& ia, bool resize_ok, const T& rfv) const;
+  Array<T> index (const Array<idx_vector>& ia, bool resize_ok) const
+  {
+    return index (ia, resize_ok, resize_fill_value ());
+  }
 
   // Indexed assignment (always with resize & fill).
 
-  void assign (const idx_vector& i, const Array<T>& rhs,
-               const T& rfv = resize_fill_value ());
+  void assign (const idx_vector& i, const Array<T>& rhs, const T& rfv);
+  void assign (const idx_vector& i, const Array<T>& rhs)
+  {
+    assign (i, rhs, resize_fill_value ());
+  }
 
-  void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs,
-               const T& rfv = resize_fill_value ());
+  void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs, const T& rfv);
+  void assign (const idx_vector& i, const idx_vector& j, const Array<T>& rhs)
+  {
+    assign (i, j, rhs, resize_fill_value ());
+  }
 
-  void assign (const Array<idx_vector>& ia, const Array<T>& rhs,
-               const T& rfv = resize_fill_value ());
+  void assign (const Array<idx_vector>& ia, const Array<T>& rhs, const T& rfv);
+  void assign (const Array<idx_vector>& ia, const Array<T>& rhs)
+  {
+    assign (ia, rhs, resize_fill_value ());
+  }
 
   // Deleting elements.
 
@@ -672,8 +695,11 @@
 
 private:
 
-  void resize2 (octave_idx_type nr, octave_idx_type nc,
-                const T& rfv = resize_fill_value ());
+  void resize2 (octave_idx_type nr, octave_idx_type nc, const T& rfv);
+  void resize2 (octave_idx_type nr, octave_idx_type nc)                
+  {
+    resize2 (nr, nc, resize_fill_value ());
+  }
 
   static void instantiation_guard ();
 };
--- a/liboctave/CColVector.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/CColVector.h	Thu May 10 16:31:02 2012 -0400
@@ -132,8 +132,7 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexColumnVector& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexColumnVector& a);
 
-  void resize (octave_idx_type n,
-               const Complex& rfv = Array<Complex>::resize_fill_value ())
+  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
   {
     Array<Complex>::resize (dim_vector (n, 1), rfv);
   }
--- a/liboctave/CMatrix.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/CMatrix.h	Thu May 10 16:31:02 2012 -0400
@@ -152,7 +152,7 @@
   ComplexColumnVector column (octave_idx_type i) const;
 
   void resize (octave_idx_type nr, octave_idx_type nc,
-               const Complex& rfv = resize_fill_value ())
+               const Complex& rfv = Complex (0))
   {
     MArray<Complex>::resize (dim_vector (nr, nc), rfv);
   }
@@ -378,9 +378,6 @@
 
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexMatrix& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexMatrix& a);
-
-  static Complex resize_fill_value (void) { return Complex (0.0, 0.0); }
-
 };
 
 extern OCTAVE_API ComplexMatrix conj (const ComplexMatrix& a);
--- a/liboctave/CNDArray.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/CNDArray.h	Thu May 10 16:31:02 2012 -0400
@@ -135,8 +135,6 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ComplexNDArray& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, ComplexNDArray& a);
 
-  static Complex resize_fill_value (void) { return Complex (0.0, 0.0); }
-
   //  bool all_elements_are_real (void) const;
   //  bool all_integers (double& max_val, double& min_val) const;
 
--- a/liboctave/CRowVector.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/CRowVector.h	Thu May 10 16:31:02 2012 -0400
@@ -112,8 +112,7 @@
   friend std::ostream& operator << (std::ostream& os, const ComplexRowVector& a);
   friend std::istream& operator >> (std::istream& is, ComplexRowVector& a);
 
-  void resize (octave_idx_type n,
-               const Complex& rfv = Array<Complex>::resize_fill_value ())
+  void resize (octave_idx_type n, const Complex& rfv = Complex (0))
   {
     Array<Complex>::resize (dim_vector (1, n), rfv);
   }
--- a/liboctave/DiagArray2.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/DiagArray2.h	Thu May 10 16:31:02 2012 -0400
@@ -150,8 +150,11 @@
   T dgxelem (octave_idx_type i) const
     { return Array<T>::xelem (i); }
 
-  void resize (octave_idx_type n, octave_idx_type m,
-               const T& rfv = Array<T>::resize_fill_value ());
+  void resize (octave_idx_type n, octave_idx_type m, const T& rfv);
+  void resize (octave_idx_type n, octave_idx_type m)
+  {
+    resize (n, m, Array<T>::resize_fill_value ());
+  }
 
   DiagArray2<T> transpose (void) const;
   DiagArray2<T> hermitian (T (*fcn) (const T&) = 0) const;
--- a/liboctave/boolMatrix.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/boolMatrix.h	Thu May 10 16:31:02 2012 -0400
@@ -84,14 +84,10 @@
   friend std::istream& operator >> (std::istream& is, Matrix& a);
 #endif
 
-  void resize (octave_idx_type nr, octave_idx_type nc,
-               bool rfv = resize_fill_value ())
+  void resize (octave_idx_type nr, octave_idx_type nc, bool rfv = false)
   {
     Array<bool>::resize (dim_vector (nr, nc), rfv);
   }
-
-  static bool resize_fill_value (void) { return false; }
-
 };
 
 MM_BOOL_OP_DECLS (boolMatrix, boolMatrix, OCTAVE_API)
--- a/liboctave/boolNDArray.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/boolNDArray.h	Thu May 10 16:31:02 2012 -0400
@@ -96,8 +96,6 @@
   // friend std::ostream& operator << (std::ostream& os, const NDArray& a);
   // friend std::istream& operator >> (std::istream& is, NDArray& a);
 
-  static bool resize_fill_value (void) { return false; }
-
   //  bool all_elements_are_real (void) const;
   //  bool all_integers (double& max_val, double& min_val) const;
 
--- a/liboctave/chMatrix.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/chMatrix.h	Thu May 10 16:31:02 2012 -0400
@@ -86,8 +86,7 @@
 
   charMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const;
 
-  void resize (octave_idx_type nr, octave_idx_type nc,
-               char rfv = resize_fill_value ())
+  void resize (octave_idx_type nr, octave_idx_type nc, char rfv = 0)
   {
     Array<char>::resize (dim_vector (nr, nc), rfv);
   }
@@ -103,9 +102,6 @@
   friend std::ostream& operator << (std::ostream& os, const Matrix& a);
   friend std::istream& operator >> (std::istream& is, Matrix& a);
 #endif
-
-  static char resize_fill_value (void) { return '\0'; }
-
 };
 
 MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API)
--- a/liboctave/chNDArray.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/chNDArray.h	Thu May 10 16:31:02 2012 -0400
@@ -92,8 +92,6 @@
   // friend std::ostream& operator << (std::ostream& os, const charNDArray& a);
   // friend std::istream& operator >> (std::istream& is, charNDArray& a);
 
-  static char resize_fill_value (void) { return '\0'; }
-
   charNDArray diag (octave_idx_type k = 0) const;
 
   charNDArray diag (octave_idx_type m, octave_idx_type n) const;
--- a/liboctave/dColVector.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/dColVector.h	Thu May 10 16:31:02 2012 -0400
@@ -99,8 +99,7 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const ColumnVector& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, ColumnVector& a);
 
-  void resize (octave_idx_type n,
-               const double& rfv = Array<double>::resize_fill_value ())
+  void resize (octave_idx_type n, const double& rfv = 0)
   {
     Array<double>::resize (dim_vector (n, 1), rfv);
   }
--- a/liboctave/dMatrix.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/dMatrix.h	Thu May 10 16:31:02 2012 -0400
@@ -125,8 +125,7 @@
 
   ColumnVector column (octave_idx_type i) const;
 
-  void resize (octave_idx_type nr, octave_idx_type nc,
-               double rfv = resize_fill_value ())
+  void resize (octave_idx_type nr, octave_idx_type nc, double rfv = 0)
   {
     MArray<double>::resize (dim_vector (nr, nc), rfv);
   }
@@ -334,8 +333,6 @@
 
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const Matrix& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, Matrix& a);
-
-  static double resize_fill_value (void) { return 0; }
 };
 
 // Publish externally used friend functions.
--- a/liboctave/dNDArray.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/dNDArray.h	Thu May 10 16:31:02 2012 -0400
@@ -150,8 +150,6 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const NDArray& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, NDArray& a);
 
-  static double resize_fill_value (void) { return 0; }
-
   NDArray diag (octave_idx_type k = 0) const;
 
   NDArray diag (octave_idx_type m, octave_idx_type n) const;
--- a/liboctave/dRowVector.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/dRowVector.h	Thu May 10 16:31:02 2012 -0400
@@ -92,8 +92,7 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const RowVector& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, RowVector& a);
 
-  void resize (octave_idx_type n,
-               const double& rfv = Array<double>::resize_fill_value ())
+  void resize (octave_idx_type n, const double& rfv = 0)
   {
     Array<double>::resize (dim_vector (1, n), rfv);
   }
--- a/liboctave/fCColVector.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/fCColVector.h	Thu May 10 16:31:02 2012 -0400
@@ -134,8 +134,7 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexColumnVector& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexColumnVector& a);
 
-  void resize (octave_idx_type n,
-               const FloatComplex& rfv = Array<FloatComplex>::resize_fill_value ())
+  void resize (octave_idx_type n, const FloatComplex& rfv = FloatComplex (0))
   {
     Array<FloatComplex>::resize (dim_vector (n, 1), rfv);
   }
--- a/liboctave/fCMatrix.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/fCMatrix.h	Thu May 10 16:31:02 2012 -0400
@@ -157,7 +157,7 @@
   FloatComplexColumnVector column (octave_idx_type i) const;
 
   void resize (octave_idx_type nr, octave_idx_type nc,
-               const FloatComplex& rfv = resize_fill_value ())
+               const FloatComplex& rfv = FloatComplex (0))
   {
     MArray<FloatComplex>::resize (dim_vector (nr, nc), rfv);
   }
@@ -383,9 +383,6 @@
 
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexMatrix& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexMatrix& a);
-
-  static FloatComplex resize_fill_value (void) { return FloatComplex (0.0, 0.0); }
-
 };
 
 extern OCTAVE_API FloatComplexMatrix conj (const FloatComplexMatrix& a);
--- a/liboctave/fCNDArray.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/fCNDArray.h	Thu May 10 16:31:02 2012 -0400
@@ -135,8 +135,6 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatComplexNDArray& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatComplexNDArray& a);
 
-  static FloatComplex resize_fill_value (void) { return FloatComplex (0.0, 0.0); }
-
   //  bool all_elements_are_real (void) const;
   //  bool all_integers (float& max_val, float& min_val) const;
 
--- a/liboctave/fCRowVector.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/fCRowVector.h	Thu May 10 16:31:02 2012 -0400
@@ -116,8 +116,7 @@
   friend std::ostream& operator << (std::ostream& os, const FloatComplexRowVector& a);
   friend std::istream& operator >> (std::istream& is, FloatComplexRowVector& a);
 
-  void resize (octave_idx_type n,
-               const FloatComplex& rfv = Array<FloatComplex>::resize_fill_value ())
+  void resize (octave_idx_type n, const FloatComplex& rfv = FloatComplex (0))
   {
     Array<FloatComplex>::resize (dim_vector (1, n), rfv);
   }
--- a/liboctave/fColVector.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/fColVector.h	Thu May 10 16:31:02 2012 -0400
@@ -102,8 +102,7 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatColumnVector& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatColumnVector& a);
 
-  void resize (octave_idx_type n,
-               const float& rfv = Array<float>::resize_fill_value ())
+  void resize (octave_idx_type n, const float& rfv = 0)
   {
     Array<float>::resize (dim_vector (n, 1), rfv);
   }
--- a/liboctave/fMatrix.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/fMatrix.h	Thu May 10 16:31:02 2012 -0400
@@ -126,8 +126,7 @@
 
   FloatColumnVector column (octave_idx_type i) const;
 
-  void resize (octave_idx_type nr, octave_idx_type nc,
-               float rfv = resize_fill_value ())
+  void resize (octave_idx_type nr, octave_idx_type nc, float rfv = 0)
   {
     MArray<float>::resize (dim_vector (nr, nc), rfv);
   }
@@ -334,9 +333,6 @@
 
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatMatrix& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatMatrix& a);
-
-  static float resize_fill_value (void) { return 0; }
-
 };
 
 // Publish externally used friend functions.
--- a/liboctave/fNDArray.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/fNDArray.h	Thu May 10 16:31:02 2012 -0400
@@ -147,8 +147,6 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatNDArray& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatNDArray& a);
 
-  static float resize_fill_value (void) { return 0; }
-
   FloatNDArray diag (octave_idx_type k = 0) const;
 
   FloatNDArray diag (octave_idx_type m, octave_idx_type n) const;
--- a/liboctave/fRowVector.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/fRowVector.h	Thu May 10 16:31:02 2012 -0400
@@ -93,8 +93,7 @@
   friend OCTAVE_API std::ostream& operator << (std::ostream& os, const FloatRowVector& a);
   friend OCTAVE_API std::istream& operator >> (std::istream& is, FloatRowVector& a);
 
-  void resize (octave_idx_type n,
-               const float& rfv = Array<float>::resize_fill_value ())
+  void resize (octave_idx_type n, const float& rfv = 0)
   {
     Array<float>::resize (dim_vector (1, n), rfv);
   }
--- a/liboctave/intNDArray.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/intNDArray.h	Thu May 10 16:31:02 2012 -0400
@@ -115,9 +115,6 @@
 
   static octave_idx_type compute_index (Array<octave_idx_type>& ra_idx,
                             const dim_vector& dimensions);
-
-  static T resize_fill_value (void) { return 0; }
-
 };
 
 // i/o
--- a/liboctave/str-vec.h	Thu May 10 11:48:48 2012 -0400
+++ b/liboctave/str-vec.h	Thu May 10 16:31:02 2012 -0400
@@ -88,7 +88,7 @@
     return longest;
   }
 
-  void resize (octave_idx_type n, const std::string& rfv = resize_fill_value ())
+  void resize (octave_idx_type n, const std::string& rfv = std::string ())
   {
     Array<std::string>::resize (dim_vector (n, 1), rfv);
   }
--- a/src/Cell.cc	Thu May 10 11:48:48 2012 -0400
+++ b/src/Cell.cc	Thu May 10 16:31:02 2012 -0400
@@ -97,7 +97,7 @@
 // SV as possible.
 
 Cell::Cell (const dim_vector& dv, const string_vector& sv, bool trim)
-  : Array<octave_value> (dv, resize_fill_value ())
+  : Array<octave_value> (dv, Matrix ())
 {
   octave_idx_type n = sv.length ();
 
@@ -173,8 +173,7 @@
         idx_vector i = idx_arg(0).index_vector ();
 
         if (! error_state)
-          retval = Array<octave_value>::index (i, resize_ok,
-                                               resize_fill_value ());
+          retval = Array<octave_value>::index (i, resize_ok, Matrix ());
       }
       break;
 
@@ -187,8 +186,7 @@
             idx_vector j = idx_arg(1).index_vector ();
 
             if (! error_state)
-              retval = Array<octave_value>::index (i, j, resize_ok,
-                                                    resize_fill_value ());
+              retval = Array<octave_value>::index (i, j, resize_ok, Matrix ());
           }
       }
       break;
@@ -206,8 +204,7 @@
           }
 
         if (!error_state)
-          retval = Array<octave_value>::index (iv, resize_ok,
-                                                resize_fill_value ());
+          retval = Array<octave_value>::index (iv, resize_ok, Matrix ());
       }
       break;
     }
--- a/src/Cell.h	Thu May 10 11:48:48 2012 -0400
+++ b/src/Cell.h	Thu May 10 16:31:02 2012 -0400
@@ -48,10 +48,10 @@
   Cell (const octave_value_list& ovl);
 
   Cell (octave_idx_type n, octave_idx_type m,
-        const octave_value& val = resize_fill_value ())
+        const octave_value& val = Matrix ())
     : Array<octave_value> (dim_vector (n, m), val) { }
 
-  Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ())
+  Cell (const dim_vector& dv, const octave_value& val = Matrix ())
     : Array<octave_value> (dv, val) { }
 
   Cell (const Array<octave_value>& c)
@@ -86,7 +86,7 @@
   using Array<octave_value>::assign;
 
   void assign (const octave_value_list& idx, const Cell& rhs,
-               const octave_value& fill_val = resize_fill_value ());
+               const octave_value& fill_val = Matrix ());
 
   Cell reshape (const dim_vector& new_dims) const
     { return Array<octave_value>::reshape (new_dims); }
@@ -110,7 +110,11 @@
   bool any_element_is_nan (void) const { return false; }
   bool is_true (void) const { return false; }
 
-  static octave_value resize_fill_value (void) { return Matrix (); }
+  octave_value resize_fill_value (void) const
+  {
+    static Matrix rfv;
+    return rfv;
+  }
 
   Cell diag (octave_idx_type k = 0) const;
 
--- a/src/oct-map.cc	Thu May 10 11:48:48 2012 -0400
+++ b/src/oct-map.cc	Thu May 10 16:31:02 2012 -0400
@@ -557,7 +557,7 @@
       for (octave_idx_type i = 0; i < nf; i++)
         {
           if (fill)
-            xvals[i].resize (dv, Cell::resize_fill_value ());
+            xvals[i].resize (dv, Matrix ());
           else
             xvals[i].resize (dv);
         }
@@ -1160,7 +1160,7 @@
       for (octave_idx_type i = 0; i < nf; i++)
         {
           if (&xvals[i] != &ref)
-            xvals[i].resize (dimensions, Cell::resize_fill_value ());
+            xvals[i].resize (dimensions, Matrix ());
         }
 
       optimize_dimensions ();
@@ -1489,7 +1489,7 @@
               Cell tmp = contents(p);
 
               if (fill)
-                tmp.resize (dv, Cell::resize_fill_value ());
+                tmp.resize (dv, Matrix ());
               else
                 tmp.resize (dv);
 
@@ -1669,7 +1669,7 @@
       if (tmp_dims != dimensions)
         {
           for (iterator p = begin (); p != end (); p++)
-            contents(p).resize (tmp_dims, Cell::resize_fill_value ());
+            contents(p).resize (tmp_dims, Matrix ());
 
           dimensions = tmp_dims;
         }
--- a/src/oct-obj.h	Thu May 10 11:48:48 2012 -0400
+++ b/src/oct-obj.h	Thu May 10 16:31:02 2012 -0400
@@ -91,8 +91,7 @@
 
   bool empty (void) const { return length () == 0; }
 
-  void resize (octave_idx_type n, const octave_value& rfv
-               = Array<octave_value>::resize_fill_value ())
+  void resize (octave_idx_type n, const octave_value& rfv = octave_value ())
   {
     data.resize (dim_vector (1, n), rfv);
   }
--- a/src/ov-complex.cc	Thu May 10 11:48:48 2012 -0400
+++ b/src/ov-complex.cc	Thu May 10 16:31:02 2012 -0400
@@ -225,7 +225,7 @@
 {
   if (fill)
     {
-      ComplexNDArray retval (dv, ComplexNDArray::resize_fill_value ());
+      ComplexNDArray retval (dv, Complex (0));
 
       if (dv.numel ())
         retval(0) = scalar;
--- a/src/ov-float.cc	Thu May 10 11:48:48 2012 -0400
+++ b/src/ov-float.cc	Thu May 10 16:31:02 2012 -0400
@@ -79,7 +79,7 @@
 {
   if (fill)
     {
-      FloatNDArray retval (dv, NDArray::resize_fill_value());
+      FloatNDArray retval (dv, 0);
 
       if (dv.numel ())
         retval(0) = scalar;
--- a/src/ov-flt-complex.cc	Thu May 10 11:48:48 2012 -0400
+++ b/src/ov-flt-complex.cc	Thu May 10 16:31:02 2012 -0400
@@ -210,7 +210,7 @@
 {
   if (fill)
     {
-      FloatComplexNDArray retval (dv, FloatComplexNDArray::resize_fill_value ());
+      FloatComplexNDArray retval (dv, FloatComplex (0));
 
       if (dv.numel ())
         retval(0) = scalar;
--- a/src/ov-range.cc	Thu May 10 11:48:48 2012 -0400
+++ b/src/ov-range.cc	Thu May 10 16:31:02 2012 -0400
@@ -335,7 +335,7 @@
 {
   NDArray retval = array_value ();
   if (fill)
-    retval.resize (dv, NDArray::resize_fill_value ());
+    retval.resize (dv, 0);
   else
     retval.resize (dv);
   return retval;
--- a/src/ov-scalar.cc	Thu May 10 11:48:48 2012 -0400
+++ b/src/ov-scalar.cc	Thu May 10 16:31:02 2012 -0400
@@ -94,7 +94,7 @@
 {
   if (fill)
     {
-      NDArray retval (dv, NDArray::resize_fill_value());
+      NDArray retval (dv, 0);
 
       if (dv.numel ())
         retval(0) = scalar;
--- a/src/ov-str-mat.cc	Thu May 10 11:48:48 2012 -0400
+++ b/src/ov-str-mat.cc	Thu May 10 16:31:02 2012 -0400
@@ -143,7 +143,7 @@
 {
   charNDArray retval (matrix);
   if (fill)
-    retval.resize (dv, charNDArray::resize_fill_value ());
+    retval.resize (dv, 0);
   else
     retval.resize (dv);
   return octave_value (retval, is_sq_string () ? '\'' : '"');