From 1c1c97cbd1d7913ac12bf550ec02c97f843a0fd3 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Sun, 20 Aug 2017 13:30:50 +0200 Subject: Modernize source code: last part (#6285) * Modernize source code: last par * Use empty when needed * Use emplace_back instead of push_back when needed * For range-based loops * Initializers fixes * constructors, destructors default * c++ C stl includes --- src/util/string.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/util/string.h') diff --git a/src/util/string.h b/src/util/string.h index 584ffb73a..122262af8 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #pragma once #include "irrlichttypes_bloated.h" -#include +#include #include #include #include @@ -231,12 +231,12 @@ inline std::vector > str_split( */ inline std::string lowercase(const std::string &str) { - std::string s2 = ""; + std::string s2; s2.reserve(str.size()); - for (size_t i = 0; i < str.size(); i++) - s2 += tolower(str[i]); + for (char i : str) + s2 += tolower(i); return s2; } @@ -607,8 +607,8 @@ std::vector > split(const std::basic_string &s, T delim) */ inline bool is_number(const std::string &to_check) { - for (size_t i = 0; i < to_check.size(); i++) - if (!std::isdigit(to_check[i])) + for (char i : to_check) + if (!std::isdigit(i)) return false; return !to_check.empty(); -- cgit v1.2.3