mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00: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
b09595e147
commit
365557ddd7
1 changed files with 8 additions and 0 deletions
|
@ -122,6 +122,13 @@ concept IterableContainer = requires {
|
|||
} -> 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>
|
||||
concept FallibleFunction = requires(Func&& func, Args&&... args) {
|
||||
func(forward<Args>(args)...).is_error();
|
||||
|
@ -173,6 +180,7 @@ using AK::Concepts::Fundamental;
|
|||
using AK::Concepts::Indexable;
|
||||
using AK::Concepts::Integral;
|
||||
using AK::Concepts::IterableContainer;
|
||||
using AK::Concepts::IterableContainerOf;
|
||||
using AK::Concepts::IteratorFunction;
|
||||
using AK::Concepts::IteratorPairWith;
|
||||
using AK::Concepts::OneOf;
|
||||
|
|
Loading…
Reference in a new issue