diff options
Diffstat (limited to 'AK/AllOf.h')
-rw-r--r-- | AK/AllOf.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/AK/AllOf.h b/AK/AllOf.h index 41a8095d1f..1248ddb471 100644 --- a/AK/AllOf.h +++ b/AK/AllOf.h @@ -6,6 +6,7 @@ #pragma once +#include <AK/Concepts.h> #include <AK/Iterator.h> namespace AK { @@ -24,6 +25,16 @@ constexpr bool all_of( return true; } +template<IterableContainer Container> +constexpr bool all_of(Container&& container, auto const& predicate) +{ + for (auto&& entry : container) { + if (!predicate(entry)) + return false; + } + return true; +} + } using AK::all_of; |