diff libinterp/corefcn/ft-text-renderer.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 89756f2f085b
line wrap: on
line diff
--- a/libinterp/corefcn/ft-text-renderer.cc	Sat Dec 03 07:37:54 2016 -0500
+++ b/libinterp/corefcn/ft-text-renderer.cc	Mon Dec 05 13:04:12 2016 -0800
@@ -601,16 +601,15 @@
         break;
 
       default:
-        for (std::list<Matrix>::const_iterator it = line_bbox.begin ();
-             it != line_bbox.end (); ++it)
+        for (const auto& lbox : line_bbox)
           {
             if (bbox.is_empty ())
-              bbox = it->extract (0, 0, 0, 3);
+              bbox = lbox.extract (0, 0, 0, 3);
             else
               {
-                bbox(1) -= (*it)(3);
-                bbox(3) += (*it)(3);
-                bbox(2) = octave::math::max (bbox(2), (*it)(2));
+                bbox(1) -= lbox(3);
+                bbox(3) += lbox(3);
+                bbox(2) = octave::math::max (bbox(2), lbox(2));
               }
           }
         break;
@@ -1075,10 +1074,10 @@
     int saved_xoffset = xoffset;
     int max_xoffset = xoffset;
 
-    for (text_element_combined::iterator it = e.begin (); it != e.end (); ++it)
+    for (auto *txt_elt : e)
       {
         xoffset = saved_xoffset;
-        (*it)->accept (*this);
+        txt_elt->accept (*this);
         max_xoffset = octave::math::max (xoffset, max_xoffset);
       }