auto loop optimizations
This commit is contained in:
@ -1129,7 +1129,7 @@ bool utils::is_integer(const std::string &str)
|
||||
{
|
||||
if (str.empty()) return false;
|
||||
|
||||
for (auto c : str) {
|
||||
for (const auto &c : str) {
|
||||
if (isdigit(c) || c == '-' || c == '+') continue;
|
||||
return false;
|
||||
}
|
||||
@ -1144,7 +1144,7 @@ bool utils::is_double(const std::string &str)
|
||||
{
|
||||
if (str.empty()) return false;
|
||||
|
||||
for (auto c : str) {
|
||||
for (const auto &c : str) {
|
||||
if (isdigit(c)) continue;
|
||||
if (c == '-' || c == '+' || c == '.') continue;
|
||||
if (c == 'e' || c == 'E') continue;
|
||||
@ -1161,7 +1161,7 @@ bool utils::is_id(const std::string &str)
|
||||
{
|
||||
if (str.empty()) return false;
|
||||
|
||||
for (auto c : str) {
|
||||
for (const auto &c : str) {
|
||||
if (isalnum(c) || (c == '_')) continue;
|
||||
return false;
|
||||
}
|
||||
@ -1178,7 +1178,7 @@ int utils::is_type(const std::string &str)
|
||||
|
||||
bool numeric = true;
|
||||
int nstar = 0;
|
||||
for (auto c : str) {
|
||||
for (const auto &c : str) {
|
||||
if (isdigit(c)) continue;
|
||||
if (c == '*') {
|
||||
++nstar;
|
||||
|
||||
Reference in New Issue
Block a user