[clang-tidy] Use new range based loops

Found with modernize-loop-convert

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2019-09-27 19:20:23 -07:00
committed by Paul Beckingham
parent 6ce2a129dd
commit a468537c1b
4 changed files with 20 additions and 20 deletions

View File

@@ -195,8 +195,8 @@ void Eval::debug (bool value)
std::vector <std::string> Eval::getOperators ()
{
std::vector <std::string> all;
for (unsigned int i = 0; i < NUM_OPERATORS; ++i)
all.push_back (operators[i].op);
for (auto & i : operators)
all.push_back (i.op);
return all;
}
@@ -206,9 +206,9 @@ std::vector <std::string> Eval::getOperators ()
std::vector <std::string> Eval::getBinaryOperators ()
{
std::vector <std::string> all;
for (unsigned int i = 0; i < NUM_OPERATORS; ++i)
if (operators[i].type == 'b')
all.push_back (operators[i].op);
for (auto & i : operators)
if (i.type == 'b')
all.push_back (i.op);
return all;
}
@@ -338,9 +338,9 @@ void Eval::evaluatePostfixStack (
case Lexer::Type::identifier:
{
bool found = false;
for (auto source = _sources.begin (); source != _sources.end (); ++source)
for (auto _source : _sources)
{
if ((*source) (token.first, v))
if (_source (token.first, v))
{
if (_debug)
Context::getContext ().debug (format ("Eval identifier source '{1}' → ↑'{2}'", token.first, (std::string) v));
@@ -669,10 +669,10 @@ bool Eval::parsePrimitive (
else
{
bool found = false;
for (auto source = _sources.begin (); source != _sources.end (); ++source)
for (auto _source : _sources)
{
Variant v;
if ((*source) (infix[i].first, v))
if (_source (infix[i].first, v))
{
found = true;
break;
@@ -810,13 +810,13 @@ bool Eval::identifyOperator (
unsigned int& precedence,
char& associativity) const
{
for (unsigned int i = 0; i < NUM_OPERATORS; ++i)
for (auto & i : operators)
{
if (operators[i].op == op)
if (i.op == op)
{
type = operators[i].type;
precedence = operators[i].precedence;
associativity = operators[i].associativity;
type = i.type;
precedence = i.precedence;
associativity = i.associativity;
return true;
}
}