mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 00:25:19 +02:00
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
This commit is contained in:
@@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#pragma once
|
||||
|
||||
#include "irrlichttypes_bloated.h"
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
@@ -231,12 +231,12 @@ inline std::vector<std::basic_string<T> > 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<std::basic_string<T> > split(const std::basic_string<T> &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();
|
||||
|
Reference in New Issue
Block a user