From 453025b18c9d08394be044951cc215d30b0283a3 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sat, 16 Apr 2022 16:23:33 +0200 Subject: [PATCH] Add an "empty" function to the ParseTree class Signed-off-by: Username404 --- src/headers/parsing/ParseComponents.hpp | 1 + src/headers/transpiler/Target.hpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/headers/parsing/ParseComponents.hpp b/src/headers/parsing/ParseComponents.hpp index e7b7b04..a373c04 100644 --- a/src/headers/parsing/ParseComponents.hpp +++ b/src/headers/parsing/ParseComponents.hpp @@ -53,6 +53,7 @@ protected: } public: inline size_t size() const { return subComponents.size(); } + inline bool empty() const { return size() == 0; } inline iterator begin() const noexcept { return subComponents.begin(); } inline constant_iterator cbegin() const noexcept { return subComponents.cbegin(); } inline iterator end() const noexcept { return subComponents.end(); } diff --git a/src/headers/transpiler/Target.hpp b/src/headers/transpiler/Target.hpp index aee6af8..7366c9f 100644 --- a/src/headers/transpiler/Target.hpp +++ b/src/headers/transpiler/Target.hpp @@ -77,7 +77,7 @@ protected: virtual print_functions_pair printFunctions() = 0; IS(ParseTree) void transpileTree(const T& parseTree, const unsigned short& indentationLevel = 0, const function&& postInsertionFunction = [](auto&){}) { - if (parseTree.size() > 0) { + if (not parseTree.empty()) { const auto added_size = indentationLevel * strlen(indentation); if (newLines) { separator.reserve(separator.size() + added_size);