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

Found with readability-container-size-empty

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2019-09-27 19:12:49 -07:00
committed by Paul Beckingham
parent d43fa66489
commit a331cceded
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.size () == 0)
if (tokens.empty())
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.size () < 1)
if (values.empty())
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.size () < 1)
if (values.empty())
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.size () &&
while (!op_stack.empty() &&
op_stack.back ().first != "(")
{
postfix.push_back (op_stack.back ());
op_stack.pop_back ();
}
if (op_stack.size ())
if (!op_stack.empty())
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.size () > 0 &&
while (!op_stack.empty() &&
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.size ())
while (!op_stack.empty())
{
if (op_stack.back ().first == "(" ||
op_stack.back ().first == ")")