Revert "[clang-tidy] Use .empty instead of comparing size"

This reverts commit a331cceded.
This commit is contained in:
Paul Beckingham
2020-12-05 16:18:15 -05:00
parent b2d46a1eba
commit 3e0a428185
18 changed files with 132 additions and 132 deletions

View File

@@ -218,7 +218,7 @@ void Eval::evaluatePostfixStack (
const std::vector <std::pair <std::string, Lexer::Type>>& tokens,
Variant& result) const
{
if (tokens.empty())
if (tokens.size () == 0)
throw std::string ("No expression to evaluate.");
// This is stack used by the postfix evaluator.
@@ -229,7 +229,7 @@ void Eval::evaluatePostfixStack (
if (token.second == Lexer::Type::op &&
token.first == "!")
{
if (values.empty())
if (values.size () < 1)
throw std::string ("The expression could not be evaluated.");
Variant right = values.back ();
@@ -242,7 +242,7 @@ void Eval::evaluatePostfixStack (
else if (token.second == Lexer::Type::op &&
token.first == "_neg_")
{
if (values.empty())
if (values.size () < 1)
throw std::string ("The expression could not be evaluated.");
Variant right = values.back ();
@@ -755,14 +755,14 @@ void Eval::infixToPostfix (
else if (token.second == Lexer::Type::op &&
token.first == ")")
{
while (!op_stack.empty() &&
while (op_stack.size () &&
op_stack.back ().first != "(")
{
postfix.push_back (op_stack.back ());
op_stack.pop_back ();
}
if (!op_stack.empty())
if (op_stack.size ())
op_stack.pop_back ();
else
throw std::string ("Mismatched parentheses in expression");
@@ -773,7 +773,7 @@ void Eval::infixToPostfix (
char type2;
unsigned int precedence2;
char associativity2;
while (!op_stack.empty() &&
while (op_stack.size () > 0 &&
identifyOperator (op_stack.back ().first, type2, precedence2, associativity2) &&
((associativity == 'l' && precedence <= precedence2) ||
(associativity == 'r' && precedence < precedence2)))
@@ -790,7 +790,7 @@ void Eval::infixToPostfix (
}
}
while (!op_stack.empty())
while (op_stack.size ())
{
if (op_stack.back ().first == "(" ||
op_stack.back ().first == ")")