mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-15 23:09:05 +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
e8b2d35410
commit
a4f23c512c
Notes:
github-actions[bot]
2024-12-04 16:47:08 +00:00
Author: https://github.com/yyny
Commit: a4f23c512c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2454
Reviewed-by: https://github.com/AtkinsSJ ✅
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…
Add table
Add a link
Reference in a new issue