From b5e1dd9a6aa5eda897c5777d9894589f030f87a7 Mon Sep 17 00:00:00 2001 From: Linkus000 Date: Sat, 1 Apr 2017 15:17:08 +0200 Subject: [PATCH] Change for loop to range-based --- src/config.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 89c1bc949..1438bcd18 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -74,9 +74,10 @@ std::vector GetConfigs() pstring configDirectory = GetConfigDirectory(); std::vector vConfigs = GetConfigs(configDirectory.c_str()); std::vector configs; + configs.reserve(vConfigs.size()); - for (auto config = vConfigs.begin(); config != vConfigs.end(); config++) - configs.push_back(config->name); + for (auto const &config: vConfigs) + configs.push_back(config.name); std::sort(configs.begin(), configs.end()); @@ -97,4 +98,4 @@ pstring GetGhConfigDirectory() mkdir(directory.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); return directory; -} \ No newline at end of file +}