mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
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.
This commit is contained in:
parent
34e9df3c5e
commit
4421d98e30
Notes:
sideshowbarker
2024-07-19 00:43:25 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/4421d98e307 Pull-request: https://github.com/SerenityOS/serenity/pull/4466
1 changed files with 7 additions and 1 deletions
|
@ -26,9 +26,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Iterator.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
constexpr bool all_of(const auto& begin, const auto& end, const auto& predicate)
|
||||
template<typename Container, typename ValueType>
|
||||
constexpr bool all_of(
|
||||
const SimpleIterator<Container, ValueType>& begin,
|
||||
const SimpleIterator<Container, ValueType>& end,
|
||||
const auto& predicate)
|
||||
{
|
||||
for (auto iter = begin; iter != end; ++iter) {
|
||||
if (!predicate(*iter)) {
|
||||
|
|
Loading…
Reference in a new issue