From 4421d98e30763424055eefe729c9cab28abdf19d Mon Sep 17 00:00:00 2001 From: Lenny Maiorani Date: Sun, 22 Nov 2020 17:09:44 -0700 Subject: [PATCH] AllOf: Common iterator types Problem: - Interface is too permissive. It permits iterators of different types as long as they are comparable. Solution: - Require iterators be the same type. --- AK/AllOf.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/AK/AllOf.h b/AK/AllOf.h index 8e2f94df1c8..5fe698b0f29 100644 --- a/AK/AllOf.h +++ b/AK/AllOf.h @@ -26,9 +26,15 @@ #pragma once +#include + namespace AK { -constexpr bool all_of(const auto& begin, const auto& end, const auto& predicate) +template +constexpr bool all_of( + const SimpleIterator& begin, + const SimpleIterator& end, + const auto& predicate) { for (auto iter = begin; iter != end; ++iter) { if (!predicate(*iter)) {