mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00: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:
parent
50669cd282
commit
1c1c97cbd1
72 changed files with 446 additions and 584 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue