diff src/Cell.cc @ 10065:64a06079cae4

improve cellstr cache implementation
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 05 Jan 2010 13:16:16 +0100
parents 8fa32b527d9a
children cd96d29c5efa
line wrap: on
line diff
--- a/src/Cell.cc
+++ b/src/Cell.cc
@@ -109,7 +109,9 @@
 {
   bool retval = true;
 
-  for (int i = 0; i < numel (); i++)
+  octave_idx_type n = numel ();
+
+  for (octave_idx_type i = 0; i < n; i++)
     {
       if (! elem(i).is_string ())
 	{
@@ -121,6 +123,19 @@
   return retval;
 }
 
+Array<std::string>
+Cell::cellstr_value (void) const
+{
+  Array<std::string> retval (dims ());
+
+  octave_idx_type n = numel ();
+
+  for (octave_idx_type i = 0; i < n; i++)
+    retval.xelem (i) = elem (i).string_value ();
+
+  return retval;
+}
+
 Cell
 Cell::index (const octave_value_list& idx_arg, bool resize_ok) const
 {