changeset 8730:474f64ab905f

src/TEMPLATE-INST/Array-tc.cc: undo previous change
author John W. Eaton <jwe@octave.org>
date Thu, 12 Feb 2009 03:44:41 -0500
parents d65a0a1780b6
children 5abe5ae55465
files src/ChangeLog src/TEMPLATE-INST/Array-tc.cc
diffstat 2 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Feb 12 09:30:33 2009 +0100
+++ b/src/ChangeLog	Thu Feb 12 03:44:41 2009 -0500
@@ -1,5 +1,10 @@
 2009-02-12  John W. Eaton  <jwe@octave.org>
 
+	* TEMPLATE-INST/Array-tc.cc: Undo previous change.
+	(octave_sort<octave_value>::ascending_compare,
+	octave_sort<octave_value>::descending_compare):
+	Pass args by const reference instead of value.
+
 	* version.h (OCTAVE_VERSION): Now 3.1.52+.
 	(OCTAVE_API_VERSION): Now api-v34+.
 
--- a/src/TEMPLATE-INST/Array-tc.cc	Thu Feb 12 09:30:33 2009 +0100
+++ b/src/TEMPLATE-INST/Array-tc.cc	Thu Feb 12 03:44:41 2009 -0500
@@ -42,7 +42,24 @@
 
 #include "oct-sort.cc"
 
-NO_INSTANTIATE_ARRAY_SORT (octave_value);
+// FIXME -- these comparisons don't look right.  Where do we sort
+// octave_value objects and expect them to be character strings?
+
+template <>
+bool
+octave_sort<octave_value>::ascending_compare (const octave_value& a, const octave_value& b)
+{
+  return (a.string_value () < b.string_value ());
+}
+
+template <>
+bool
+octave_sort<octave_value>::descending_compare (const octave_value& a, const octave_value& b)
+{
+  return (a.string_value () > b.string_value ());
+}
+
+INSTANTIATE_ARRAY_SORT (octave_value);
 
 INSTANTIATE_ARRAY (octave_value, OCTINTERP_API);