diff --git a/SystemTools.cxx b/SystemTools.cxx
index 0d03453369fc836855970673f7134844037dfc40..4a42addd6b12a00ff8ac1782da122f215fda85d1 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -2959,10 +2959,9 @@ std::string SystemTools::FindProgram(const std::vector<std::string>& names,
                                      const std::vector<std::string>& path,
                                      bool noSystemPath)
 {
-  for (std::vector<std::string>::const_iterator it = names.begin();
-       it != names.end(); ++it) {
+  for (std::string const& name : names) {
     // Try to find the program.
-    std::string result = SystemTools::FindProgram(*it, path, noSystemPath);
+    std::string result = SystemTools::FindProgram(name, path, noSystemPath);
     if (!result.empty()) {
       return result;
     }