diff src/OPERATORS/op-fcn.cc @ 10322:21551cc88061

improve function handles comparison
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 15 Feb 2010 07:13:12 +0100
parents 07dedea2e0a4
children fd0a3ac60b0e
line wrap: on
line diff
--- a/src/OPERATORS/op-fcn.cc	Sat Feb 13 08:17:21 2010 +0100
+++ b/src/OPERATORS/op-fcn.cc	Mon Feb 15 07:13:12 2010 +0100
@@ -36,19 +36,19 @@
 {
   CAST_BINOP_ARGS (const octave_fcn_handle&, const octave_fcn_handle&);
 
-  // FIXME: this may not be entirely correct in case the handles were created
-  // in different directories. Needs checking what recent Matlab does, and also
-  // discussion whether we want to copy its behavior. Or to what extent.
-  // Meanwhile, this catches all the "normal" usages, i.e.
-  //   h == @sin
-  // should yield true only if h is a handle to the global "sin", not a local one.
+  return v1.is_equal_to (v2);
+}
 
-  return (v1.fcn_name () == v2.fcn_name () 
-          && v1.fcn_val ().is_copy_of (v2.fcn_val ()));
+DEFBINOP (ne, fcn_handle, fcn_handle)
+{
+  CAST_BINOP_ARGS (const octave_fcn_handle&, const octave_fcn_handle&);
+
+  return ! v1.is_equal_to (v2);
 }
 
 void
 install_fcn_ops (void)
 {
   INSTALL_BINOP (op_eq, octave_fcn_handle, octave_fcn_handle, eq);
+  INSTALL_BINOP (op_ne, octave_fcn_handle, octave_fcn_handle, ne);
 }