diff libinterp/octave-value/ov-struct.cc @ 20681:b0b37f0d7e6d

new cellstr_value function and elimination of error_state * ov.h (octave_value::cellstr_value): New overloaded function with extra error message. * ov-base.h, ov-base.cc (octave_base_value::cellstr_value): Likewise. * ov-cell.h, ov-cell.cc (octave_cell::cellstr_value): Likewise. * ov-str-mat.h, ov-str-mat.cc (octave_str_mat::cellstr_value): Likewise. * graphics.cc, urlwrite.cc, ov-cell.cc, ov-class.cc, ov-struct.cc: Use new cellstr_value function and eliminate use of error_state.
author John W. Eaton <jwe@octave.org>
date Thu, 05 Nov 2015 17:22:16 -0500
parents 96163bdd2ea1
children 68e3a747ca02
line wrap: on
line diff
--- a/libinterp/octave-value/ov-struct.cc	Thu Nov 05 16:09:38 2015 -0500
+++ b/libinterp/octave-value/ov-struct.cc	Thu Nov 05 17:22:16 2015 -0500
@@ -1814,10 +1814,9 @@
 
       if (nargin == 2)
         {
-          if (args(1).is_cellstr ())
-            retval = octave_map (args(0).dims (), args(1).cellstr_value ());
-          else
-            error ("struct: expecting cell array of field names as second argument");
+          Array<std::string> cstr = args(1).cellstr_value ("struct: expecting cell array of field names as second argument");
+
+          retval = octave_map (args(0).dims (), cstr);
         }
       else
         retval = octave_map (args(0).dims ());