changeset 4518:382cb0ed8c14

[project @ 2003-09-20 18:08:40 by jwe]
author jwe
date Sat, 20 Sep 2003 18:08:40 +0000
parents b4449b1193ac
children 8e1c04e506ce
files liboctave/Array.cc liboctave/Array.h liboctave/ChangeLog
diffstat 3 files changed, 55 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array.cc	Sat Sep 20 02:06:07 2003 +0000
+++ b/liboctave/Array.cc	Sat Sep 20 18:08:40 2003 +0000
@@ -30,6 +30,7 @@
 #endif
 
 #include <cassert>
+#include <climits>
 
 #include <iostream>
 
--- a/liboctave/Array.h	Sat Sep 20 02:06:07 2003 +0000
+++ b/liboctave/Array.h	Sat Sep 20 18:08:40 2003 +0000
@@ -135,8 +135,16 @@
 
   typename Array<T>::ArrayRep *rep;
 
+public:
+
+  // !!! WARNING !!! -- this is public because template friends don't
+  // work properly with versions of gcc earlier than 3.3.  You should
+  // not access this data member directly!
+
   dim_vector dimensions;
 
+protected:
+
   idx_vector *idx;
   int idx_count;
 
@@ -394,7 +402,13 @@
   T operator () (const Array<int>& ra_idx) const { return elem (ra_idx); }
 #endif
 
-protected:
+  // !!! WARNING !!! -- the following resize_no_fill and
+  // resize_and_fill functions are public because template friends
+  // don't work properly with versions of gcc earlier than 3.3.  You
+  // should use these functions only in classes that are derived
+  // from Array<T>.
+
+  // protected:
 
   void resize_no_fill (int n);
 
@@ -489,25 +503,29 @@
 
   //  static T resize_fill_value (void) { return T (); }
 
-  template <class LT, class RT>
-  friend int
-  assign (Array<LT>& lhs, const Array<RT>& rhs, const LT& rfv);
-
-  template <class LT, class RT>
-  friend int
-  assign1 (Array<LT>& lhs, const Array<RT>& rhs, const LT& rfv);
-
-  template <class LT, class RT>
-  friend int
-  assign2 (Array<LT>& lhs, const Array<RT>& rhs, const LT& rfv);
-
-  template <class LT, class RT>
-  friend int
-  assignN (Array<LT>& lhs, const Array<RT>& rhs, const LT& rfv);
-
   void print_info (std::ostream& os, const std::string& prefix) const;
 };
 
+// NOTE: these functions should be friends of the Array<T> class and
+// Array<T>::dimensions should be protected, not public, but we can't
+// do that because of bugs in gcc prior to 3.3.
+
+template <class LT, class RT>
+/* friend */ int
+assign (Array<LT>& lhs, const Array<RT>& rhs, const LT& rfv);
+
+template <class LT, class RT>
+/* friend */ int
+assign1 (Array<LT>& lhs, const Array<RT>& rhs, const LT& rfv);
+
+template <class LT, class RT>
+/* friend */ int
+assign2 (Array<LT>& lhs, const Array<RT>& rhs, const LT& rfv);
+
+template <class LT, class RT>
+/* friend */ int
+assignN (Array<LT>& lhs, const Array<RT>& rhs, const LT& rfv);
+
 template <class LT, class RT>
 int
 assign (Array<LT>& lhs, const Array<RT>& rhs)
--- a/liboctave/ChangeLog	Sat Sep 20 02:06:07 2003 +0000
+++ b/liboctave/ChangeLog	Sat Sep 20 18:08:40 2003 +0000
@@ -1,3 +1,22 @@
+2003-09-20  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* Array.h (dimensions): Now public.
+	template <class LT, class RT>
+	(assign (Array<LT>&, const Array<RT>&, const LT&),
+	assign1 (Array<LT>&, const Array<RT>&, const LT&),
+	assign2 (Array<LT>&, const Array<RT>&, const LT&),
+	assignN (Array<LT>&, const Array<RT>&, const LT&),
+	resize_no_fill (int),
+	resize_no_fill (int, int),
+	resize_no_fill (int, int, int),
+	resize_no_fill (const dim_vector&),
+	resize_and_fill (int, const T&),
+	resize_and_fill (int, int, const T&),
+	resize_and_fill (int, int, int, const T&),
+	resize_and_fill (const dim_vector&, const T&)): Now public.
+
+	* Array.cc: Include <climits>.
+
 2003-09-19  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* Array.cc: Merge Array-idx.h.