Fix ranges::filter crash ()

This commit is contained in:
Jasmine 2025-02-04 23:45:35 -05:00 committed by GitHub
parent d00480078c
commit 174296814b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -209,7 +209,7 @@ namespace geode::utils::ranges {
template <ValidContainer C, ValidCUnaryPredicate<C> Predicate>
C filter(C const& container, Predicate filterFun) {
auto res = C();
std::copy_if(container.begin(), container.end(), res.end(), filterFun);
std::copy_if(container.begin(), container.end(), std::back_inserter(res), filterFun);
return res;
}