1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:37:35 +00:00

AK: Rewrite {AnyOf,AllOf,Find}.h to use the IteratorPairWith concept

This makes it so these algorithms are usable with arbitrary iterators,
as opposed to just instances of AK::SimpleIterator.
This commit also makes the requirement of ::index() in find_index()
explicit, as previously it was accepting any iterator.
This commit is contained in:
Ali Mohammad Pur 2021-07-22 19:19:34 +04:30 committed by Andreas Kling
parent 2dc31c503e
commit 73fc2b3748
3 changed files with 15 additions and 14 deletions

View file

@ -11,10 +11,10 @@
namespace AK {
template<typename Container, typename ValueType>
template<typename TEndIterator, IteratorPairWith<TEndIterator> TIterator>
constexpr bool all_of(
SimpleIterator<Container, ValueType> const& begin,
SimpleIterator<Container, ValueType> const& end,
TIterator const& begin,
TEndIterator const& end,
auto const& predicate)
{
for (auto iter = begin; iter != end; ++iter) {