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 iterator end() const noexcept { return subComponents.end(); } | ||||||
|     inline const_iterator cend() const noexcept { return subComponents.cend(); } |     inline const_iterator cend() const noexcept { return subComponents.cend(); } | ||||||
|     IS_PARSECOMPONENT |     IS_PARSECOMPONENT | ||||||
|     auto findById() const { |     vector<T*> findById() const { | ||||||
|         return subComponents | filter([](unique_ptr<ParseComponent>& it) -> bool { |         vector<T*> filteredComponents; | ||||||
|             return it->getId() == typeid(T); |         for_each(cbegin(), cend(), [&filteredComponents](const unique_ptr<ParseComponent>& it) { | ||||||
|         }) | transform([](unique_ptr<ParseComponent>& it) { |             if (it->getId() == typeid(T)) { | ||||||
|             return reinterpret_cast<T*>(it.get()); |                 filteredComponents.push_back(reinterpret_cast<T*>(it.get())); | ||||||
|  |             } | ||||||
|         }); |         }); | ||||||
|  |         return filteredComponents; | ||||||
|     } |     } | ||||||
|     IS(StandardComponents::NamedIdentifier) |     IS(StandardComponents::NamedIdentifier) | ||||||
|     optional<reference_wrapper<T>> findReferenceByName(const string& name) const { |     optional<reference_wrapper<T>> findReferenceByName(const string& name) const { | ||||||
|         auto identifiers = findById<T>() | transform([](T* it) { |         auto identifiers = findById<T>(); | ||||||
|             return ref(static_cast<T&>(*it)); |  | ||||||
|         }); |  | ||||||
|         for (const auto& identifier: identifiers) { |         for (const auto& identifier: identifiers) { | ||||||
|             if (identifier.get().getId() == typeid(T) && identifier.get().name == name) { |             if (identifier->getId() == typeid(T) && identifier->name == name) { | ||||||
|                 return make_optional(identifier); |                 return make_optional(ref(static_cast<T&>(*identifier))); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return optional<reference_wrapper<T>>(); |         return optional<reference_wrapper<T>>(); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user