diff libinterp/corefcn/strfind.cc @ 22862:e365e87371a3

maint: Use C++ range feature to simplify some for loops in libinterp/corefcn. * symtab.cc, call-stack.cc, comment-list.cc, defun.cc, dynamic-ld.cc, error.cc, ft-text-renderer.cc, gl2ps-print.cc, graphics.cc, help.cc, interpreter.cc, load-path.cc, load-save.cc, ls-mat5.cc, oct-errno.in.cc, oct-map.cc, oct-stream.cc, octave-link.cc, profiler.cc, regexp.cc, strfind.cc, symtab.h, txt-eng.h, urlwrite.cc, variables.cc: maint: Use C++ range feature to simplify some for loops in libinterp/corefcn.
author Rik <rik@octave.org>
date Mon, 05 Dec 2016 13:04:12 -0800
parents 3a2b891d0b33
children ef4d915df748
line wrap: on
line diff
--- a/libinterp/corefcn/strfind.cc	Sat Dec 03 07:37:54 2016 -0500
+++ b/libinterp/corefcn/strfind.cc	Mon Dec 05 13:04:12 2016 -0800
@@ -138,11 +138,8 @@
   octave_idx_type one = 1;
   Array<octave_idx_type> result (dim_vector (std::min (one, nmatch), nmatch));
   octave_idx_type k = 0;
-  for (std::deque<octave_idx_type>::const_iterator iter = accum.begin ();
-       iter != accum.end (); iter++)
-    {
-      result.xelem (k++) = *iter;
-    }
+  for (const auto& idx : accum)
+    result.xelem (k++) = idx;
 
   return result;
 }