auto loop optimizations

This commit is contained in:
Axel Kohlmeyer
2022-09-10 03:07:28 -04:00
parent 8030fc09e3
commit 22709b73e2
12 changed files with 28 additions and 28 deletions

View File

@ -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;