diff src/Cell.cc @ 7530:bb0f2353cff5

new cell array ctype mappers
author John W. Eaton <jwe@octave.org>
date Mon, 25 Feb 2008 19:01:30 -0500
parents f06b8150fe56
children 3209a584e1ac
line wrap: on
line diff
--- a/src/Cell.cc	Mon Feb 25 16:09:48 2008 -0500
+++ b/src/Cell.cc	Mon Feb 25 19:01:30 2008 -0500
@@ -224,6 +224,20 @@
   return *this;
 }
 
+Cell
+Cell::map (ctype_mapper fcn) const
+{
+  Cell retval (dims ());
+  octave_value *r = retval.fortran_vec ();
+
+  const octave_value *p = data ();
+
+  for (octave_idx_type i = 0; i < numel (); i++)
+    r[i] = ((p++)->*fcn) ();
+
+  return retval;
+}
+
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***