changeset 30420:366aa563dd2e stable

style fixes for Range.h and Range.cc * Range.h, Range.cc: Don't pass bool function arguments as const reference. Do pass non-pod object function argumennts as const reference where possible.
author John W. Eaton <jwe@octave.org>
date Thu, 02 Dec 2021 14:18:48 -0500
parents 420608d1d370
children b8c7c550e86f 2033c05c9522
files liboctave/array/Range.cc liboctave/array/Range.h
diffstat 2 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/Range.cc	Thu Dec 02 11:24:41 2021 -0500
+++ b/liboctave/array/Range.cc	Thu Dec 02 14:18:48 2021 -0500
@@ -192,7 +192,7 @@
 
   template <typename T>
   void
-  xinit (T base, T limit, T inc, const bool reverse, T& final_val,
+  xinit (T base, T limit, T inc, bool reverse, T& final_val,
          octave_idx_type& nel)
   {
     // Catch obvious NaN ranges.
@@ -259,8 +259,8 @@
 
   template <typename T>
   void
-  xinit (const octave_int<T> base, const octave_int<T> limit,
-         const octave_int<T> inc, const bool reverse,
+  xinit (const octave_int<T>& base, const octave_int<T>& limit,
+         const octave_int<T>& inc, bool reverse,
          octave_int<T>& final_val, octave_idx_type& nel)
   {
     // We need an integer division that is truncating decimals instead
--- a/liboctave/array/Range.h	Thu Dec 02 11:24:41 2021 -0500
+++ b/liboctave/array/Range.h	Thu Dec 02 14:18:48 2021 -0500
@@ -57,7 +57,7 @@
     // to the value of base + a multiple of the increment.
 
     range (const T& base, const T& increment, const T& limit,
-           const bool& reverse = false)
+           bool reverse = false)
       : m_base (base), m_increment (increment), m_limit (limit),
         m_final (), m_numel (), m_reverse (reverse)
     {
@@ -82,13 +82,13 @@
     // FIXME: Is there a way to limit this to T == double?
 
     range (const T& base, const T& increment, const T& limit,
-           octave_idx_type numel, const bool& reverse = false)
+           octave_idx_type numel, bool reverse = false)
       : m_base (base), m_increment (increment), m_limit (limit),
         m_final (limit), m_numel (numel), m_reverse (reverse)
     { }
 
     range (const T& base, const T& increment, const T& limit,
-           const T& final, octave_idx_type numel, const bool& reverse = false)
+           const T& final, octave_idx_type numel, bool reverse = false)
       : m_base (base), m_increment (increment), m_limit (limit),
         m_final (final), m_numel (numel), m_reverse (reverse)
     { }
@@ -97,7 +97,7 @@
     // range<T> (base, limit) when T is octave_idx_type.
 
     static range<T> make_constant (const T& base, octave_idx_type numel,
-                                   const bool& reverse = false)
+                                   bool reverse = false)
     {
       // We could just make this constructor public, but it allows
       // inconsistent ranges to be constructed.  And it is probably much