2021-01-14 22:36:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
*
|
2021-04-22 08:24:48 +00:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-01-14 22:36:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Iterator.h>
|
|
|
|
|
|
|
|
namespace AK {
|
|
|
|
|
|
|
|
template<typename Container, typename ValueType>
|
|
|
|
constexpr bool any_of(
|
|
|
|
const SimpleIterator<Container, ValueType>& begin,
|
|
|
|
const SimpleIterator<Container, ValueType>& end,
|
|
|
|
const auto& predicate)
|
|
|
|
{
|
|
|
|
for (auto iter = begin; iter != end; ++iter) {
|
|
|
|
if (predicate(*iter)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2021-02-07 10:35:08 +00:00
|
|
|
|
|
|
|
using AK::any_of;
|