Add an "empty" function to the ParseTree class

Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404 2022-04-16 16:23:33 +02:00
parent d059d1e507
commit 453025b18c
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 2 additions and 1 deletions

View File

@ -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(); }

View File

@ -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<void(decltype(parseTree.cbegin())&)>&& 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);