changeset 7443:d98dea7d16b0

[project @ 2008-02-03 20:58:12 by jwe]
author jwe
date Sun, 03 Feb 2008 20:58:12 +0000
parents da006c2fe55c
children 1e1e2608da7b
files liboctave/Array-d.cc liboctave/Array.cc liboctave/ChangeLog
diffstat 3 files changed, 33 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/Array-d.cc
+++ b/liboctave/Array-d.cc
@@ -344,30 +344,30 @@
 
 template <>
 bool
-Array<double>::ascending_compare (double a, double b) const
+ascending_compare (double a, double b)
 {
   return (xisnan (b) || (a < b));
 }
 
 template <>
 bool
-Array<double>::ascending_compare (vec_index<double> *a, 
-				  vec_index<double> *b) const
+ascending_compare (vec_index<double> *a, 
+		   vec_index<double> *b)
 {
   return (xisnan (b->vec) || (a->vec < b->vec));
 }
 
 template <>
 bool
-Array<double>::descending_compare (double a, double b) const
+descending_compare (double a, double b)
 {
   return (xisnan (a) || (a > b));
 }
 
 template <>
 bool
-Array<double>::descending_compare (vec_index<double> *a, 
-				   vec_index<double> *b) const
+descending_compare (vec_index<double> *a, 
+		    vec_index<double> *b)
 {
   return (xisnan (b->vec) || (a->vec > b->vec));
 }
--- a/liboctave/Array.cc
+++ b/liboctave/Array.cc
@@ -2629,6 +2629,25 @@
   return m;
 }
 
+#if defined (HAVE_IEEE754_DATA_FORMAT)
+
+template <>
+extern bool ascending_compare (double, double);
+template <>
+extern bool ascending_compare (vec_index<double>*, vec_index<double>*);
+template <>
+extern bool descending_compare (double, double);
+template <>
+extern bool descending_compare (vec_index<double>*, vec_index<double>*);
+
+template <>
+Array<double> Array<double>::sort (octave_idx_type dim, sortmode mode) const;
+template <>
+Array<double> Array<double>::sort (Array<octave_idx_type> &sidx,
+				   octave_idx_type dim, sortmode mode) const;
+
+#endif
+
 // FIXME -- this is a mess.
 
 template <class LT, class RT>
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,11 @@
+2008-02-03  Michael Goffioul <michael.goffioul@gmail.com>
+
+	* Array.cc (ascending_compare, descending_compare,
+	Array<T>::sort): Declare explicit specialization for T=double to
+	avoid symbol duplication error at link time.
+	* Array-d.cc (ascending_compare, descending_compare): Declare and
+	define as nonmember functions, not member functions of Array<T>.
+
 2008-02-03  John W. Eaton  <jwe@octave.org>
 
 	* Array-i.cc: Also instantiate Arrays for long long type if it exists.