mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
AK: Add IterableContainerOf concept
This concept not only checks that the given type is iterable, but it also checks that the iterated value is of the expected type.
This commit is contained in:
parent
e8b2d35410
commit
a4f23c512c
|
|
@ -122,6 +122,13 @@ concept IterableContainer = requires {
|
||||||
} -> IteratorPairWith<decltype(declval<T>().end())>;
|
} -> IteratorPairWith<decltype(declval<T>().end())>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T, typename ValueT>
|
||||||
|
concept IterableContainerOf = IterableContainer<T> && requires {
|
||||||
|
{
|
||||||
|
*declval<T>().begin()
|
||||||
|
} -> SameAs<ValueT>;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename Func, typename... Args>
|
template<typename Func, typename... Args>
|
||||||
concept FallibleFunction = requires(Func&& func, Args&&... args) {
|
concept FallibleFunction = requires(Func&& func, Args&&... args) {
|
||||||
func(forward<Args>(args)...).is_error();
|
func(forward<Args>(args)...).is_error();
|
||||||
|
|
@ -173,6 +180,7 @@ using AK::Concepts::Fundamental;
|
||||||
using AK::Concepts::Indexable;
|
using AK::Concepts::Indexable;
|
||||||
using AK::Concepts::Integral;
|
using AK::Concepts::Integral;
|
||||||
using AK::Concepts::IterableContainer;
|
using AK::Concepts::IterableContainer;
|
||||||
|
using AK::Concepts::IterableContainerOf;
|
||||||
using AK::Concepts::IteratorFunction;
|
using AK::Concepts::IteratorFunction;
|
||||||
using AK::Concepts::IteratorPairWith;
|
using AK::Concepts::IteratorPairWith;
|
||||||
using AK::Concepts::OneOf;
|
using AK::Concepts::OneOf;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user