diff liboctave/Array.h @ 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 e8d87fefd144
line wrap: on
line diff
--- 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)