changeset 20988:8b8d8c6c0e64

Add new member function is_empty to Range type. Use it. * Range.h (is_empty): New function. * ov-range.cc (is_true): Use is_empty rather than "numel () == 0".
author Rik <rik@octave.org>
date Sat, 26 Dec 2015 07:58:08 -0800
parents f99cbd86a0f9
children 98e75f952a36
files libinterp/octave-value/ov-range.cc liboctave/array/Range.h
diffstat 2 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-range.cc	Sat Dec 26 08:49:41 2015 +0100
+++ b/libinterp/octave-value/ov-range.cc	Sat Dec 26 07:58:08 2015 -0800
@@ -273,7 +273,7 @@
 {
   bool retval = false;
 
-  if (! range.numel () != 0)
+  if (! range.is_empty ())
     {
       // FIXME: this is a potential waste of memory.
 
--- a/liboctave/array/Range.h	Sat Dec 26 08:49:41 2015 +0100
+++ b/liboctave/array/Range.h	Sat Dec 26 07:58:08 2015 -0800
@@ -100,6 +100,7 @@
   double inc (void) const { return rng_inc; }
   GCC_ATTR_DEPRECATED octave_idx_type nelem (void) const { return numel (); }
   octave_idx_type numel (void) const { return rng_numel; }
+  bool is_empty (void) const { return numel () == 0; }
 
   bool all_elements_are_ints (void) const;