Fix the findById() and findReferenceByName() methods in ParseComponents.hpp since the filter function doesn't actually exist
This commit is contained in:
		
							parent
							
								
									2672f33959
								
							
						
					
					
						commit
						33ee011aed
					
				| @ -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<ParseComponent>& it) -> bool { | ||||
|             return it->getId() == typeid(T); | ||||
|         }) | transform([](unique_ptr<ParseComponent>& it) { | ||||
|             return reinterpret_cast<T*>(it.get()); | ||||
|     vector<T*> findById() const { | ||||
|         vector<T*> filteredComponents; | ||||
|         for_each(cbegin(), cend(), [&filteredComponents](const unique_ptr<ParseComponent>& it) { | ||||
|             if (it->getId() == typeid(T)) { | ||||
|                 filteredComponents.push_back(reinterpret_cast<T*>(it.get())); | ||||
|             } | ||||
|         }); | ||||
|         return filteredComponents; | ||||
|     } | ||||
|     IS(StandardComponents::NamedIdentifier) | ||||
|     optional<reference_wrapper<T>> findReferenceByName(const string& name) const { | ||||
|         auto identifiers = findById<T>() | transform([](T* it) { | ||||
|             return ref(static_cast<T&>(*it)); | ||||
|         }); | ||||
|         auto identifiers = findById<T>(); | ||||
|         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<T&>(*identifier))); | ||||
|             } | ||||
|         } | ||||
|         return optional<reference_wrapper<T>>(); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user