From dd223026a01bc00f1bf502e3f883238d70ac4c36 Mon Sep 17 00:00:00 2001 From: Username404 Date: Sun, 8 Aug 2021 14:59:47 +0200 Subject: [PATCH] Fix the findByName function. --- src/headers/parsing/ParseComponents.hpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/headers/parsing/ParseComponents.hpp b/src/headers/parsing/ParseComponents.hpp index ef81f7d..f8ceedb 100644 --- a/src/headers/parsing/ParseComponents.hpp +++ b/src/headers/parsing/ParseComponents.hpp @@ -52,10 +52,11 @@ protected: public: IS(StandardComponents::NamedIdentifier) optional> findByName(const string& name) { - auto identifiers = findById(); - for (const auto& identifier: identifiers) { - if (identifier.name == name) { - return identifier; + auto identifiers = findById(); + for (auto&& identifier: identifiers) { + if (identifier.getId() == typeid(T) && identifier.name == name) { + return make_optional(reference_wrapper(identifier)); + break; } } return optional>();