changeset 243:e51dba005f87

Add evaluation through anonymous functions
author Eugenio Gianniti <eugenio.gianniti@mail.polimi.it>
date Fri, 27 Jun 2014 17:29:11 +0200
parents 958a0e0e8102
children 3a0590e19bf7
files src/function.h
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/function.h	Wed Jun 25 22:32:38 2014 +0200
+++ b/src/function.h	Fri Jun 27 17:29:11 2014 +0200
@@ -89,9 +89,7 @@
         {
         case '(':
           {
-            std::list<octave_value_list> args (idx);
-            args.push_front (octave_value (new function (*this)));
-            retval = feval ("feval", args, nargout);
+            retval = do_multi_index_op (nargout, idx.front ());
           }
           break;
 
@@ -110,6 +108,16 @@
       return retval;
     }
 
+  octave_value_list
+  do_multi_index_op (int nargout, const octave_value_list& idx)
+    {
+      octave_value_list retval;
+      std::list<octave_value_list> args (1, idx);
+      args.push_front (octave_value (new function (*this)));
+      retval = feval ("feval", args, nargout);
+      return retval;
+    }
+
  private:
 
   std::string str;