From 33ee011aedb19942df2f69145a5096b7f3cab4d0 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sun, 12 Sep 2021 16:45:12 +0200 Subject: [PATCH] Fix the findById() and findReferenceByName() methods in ParseComponents.hpp since the filter function doesn't actually exist --- src/headers/parsing/ParseComponents.hpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/headers/parsing/ParseComponents.hpp b/src/headers/parsing/ParseComponents.hpp index 6ed1f10..8e9938c 100644 --- a/src/headers/parsing/ParseComponents.hpp +++ b/src/headers/parsing/ParseComponents.hpp @@ -59,21 +59,21 @@ public: inline iterator end() const noexcept { return subComponents.end(); } inline const_iterator cend() const noexcept { return subComponents.cend(); } IS_PARSECOMPONENT - auto findById() const { - return subComponents | filter([](unique_ptr& it) -> bool { - return it->getId() == typeid(T); - }) | transform([](unique_ptr& it) { - return reinterpret_cast(it.get()); + vector findById() const { + vector filteredComponents; + for_each(cbegin(), cend(), [&filteredComponents](const unique_ptr& it) { + if (it->getId() == typeid(T)) { + filteredComponents.push_back(reinterpret_cast(it.get())); + } }); + return filteredComponents; } IS(StandardComponents::NamedIdentifier) optional> findReferenceByName(const string& name) const { - auto identifiers = findById() | transform([](T* it) { - return ref(static_cast(*it)); - }); + auto identifiers = findById(); for (const auto& identifier: identifiers) { - if (identifier.get().getId() == typeid(T) && identifier.get().name == name) { - return make_optional(identifier); + if (identifier->getId() == typeid(T) && identifier->name == name) { + return make_optional(ref(static_cast(*identifier))); } } return optional>();