changeset 21113:2bbbbb96f631

ov-complex.cc: Incorporate gripe_complex_index into calling fcn. * ov-complex.cc (gripe_complex_index): Delete function. * ov-complex.cc (octave_complex::index_vector): Incorporate gripe_complex_index code into function.
author Rik <rik@octave.org>
date Tue, 19 Jan 2016 15:58:08 -0800
parents 358aa7fcbd33
children 47908b818865
files libinterp/octave-value/ov-complex.cc
diffstat 1 files changed, 5 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-complex.cc	Tue Jan 19 15:43:18 2016 -0800
+++ b/libinterp/octave-value/ov-complex.cc	Tue Jan 19 15:58:08 2016 -0800
@@ -79,16 +79,6 @@
   }
 };
 
-static void
-gripe_complex_index (const Complex& idx)
-{
-  std::ostringstream buf;
-  buf << std::real (idx) << std::showpos << std::imag (idx) << "i";
-  complex_index_exception e (buf.str ());
-
-  throw e;
-}
-
 static octave_base_value *
 default_numeric_demotion_function (const octave_base_value& a)
 {
@@ -136,12 +126,15 @@
   return tmp.do_index_op (idx, resize_ok);
 }
 
+// Can't make an index_vector from a complex number.  Throw an error.
 idx_vector
 octave_complex::index_vector (bool) const
 {
-  gripe_complex_index (scalar);
+  std::ostringstream buf;
+  buf << std::real (scalar) << std::showpos << std::imag (scalar) << "i";
+  complex_index_exception e (buf.str ());
 
-  return idx_vector ();
+  throw e;
 }
 
 double