mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
AK: Add a 'OneOf' concept
Similar to 'SameAs', but for multiple types.
This commit is contained in:
parent
2a1a619eed
commit
06cedf5bae
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/06cedf5bae Pull-request: https://github.com/SerenityOS/serenity/pull/13310 Reviewed-by: https://github.com/IdanHo
2 changed files with 8 additions and 0 deletions
|
@ -36,6 +36,9 @@ concept Enum = IsEnum<T>;
|
|||
template<typename T, typename U>
|
||||
concept SameAs = IsSame<T, U>;
|
||||
|
||||
template<typename U, typename... Ts>
|
||||
concept OneOf = IsOneOf<U, Ts...>;
|
||||
|
||||
template<typename T, template<typename...> typename S>
|
||||
concept SpecializationOf = IsSpecializationOf<T, S>;
|
||||
|
||||
|
@ -117,6 +120,7 @@ using AK::Concepts::Integral;
|
|||
using AK::Concepts::IterableContainer;
|
||||
using AK::Concepts::IteratorFunction;
|
||||
using AK::Concepts::IteratorPairWith;
|
||||
using AK::Concepts::OneOf;
|
||||
using AK::Concepts::SameAs;
|
||||
using AK::Concepts::Signed;
|
||||
using AK::Concepts::SpecializationOf;
|
||||
|
|
|
@ -572,6 +572,9 @@ inline constexpr bool IsHashCompatible = false;
|
|||
template<typename T>
|
||||
inline constexpr bool IsHashCompatible<T, T> = true;
|
||||
|
||||
template<typename T, typename... Ts>
|
||||
inline constexpr bool IsOneOf = (IsSame<T, Ts> || ...);
|
||||
|
||||
}
|
||||
using AK::Detail::AddConst;
|
||||
using AK::Detail::AddLvalueReference;
|
||||
|
@ -607,6 +610,7 @@ using AK::Detail::IsLvalueReference;
|
|||
using AK::Detail::IsMoveAssignable;
|
||||
using AK::Detail::IsMoveConstructible;
|
||||
using AK::Detail::IsNullPointer;
|
||||
using AK::Detail::IsOneOf;
|
||||
using AK::Detail::IsPOD;
|
||||
using AK::Detail::IsPointer;
|
||||
using AK::Detail::IsRvalueReference;
|
||||
|
|
Loading…
Add table
Reference in a new issue