mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
AK: Add a OneOfIgnoringCV concept
Some functions want to ignore cv-qualifiers, and it's much easier to constrain the type through a concept than a separate requires clause on the function.
This commit is contained in:
parent
5d1deac9a8
commit
2b79f36148
Notes:
sideshowbarker
2024-07-17 11:41:01 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/2b79f36148 Pull-request: https://github.com/SerenityOS/serenity/pull/13716
@ -39,6 +39,9 @@ concept SameAs = IsSame<T, U>;
|
|||||||
template<typename U, typename... Ts>
|
template<typename U, typename... Ts>
|
||||||
concept OneOf = IsOneOf<U, Ts...>;
|
concept OneOf = IsOneOf<U, Ts...>;
|
||||||
|
|
||||||
|
template<typename U, typename... Ts>
|
||||||
|
concept OneOfIgnoringCV = IsOneOfIgnoringCV<U, Ts...>;
|
||||||
|
|
||||||
template<typename T, template<typename...> typename S>
|
template<typename T, template<typename...> typename S>
|
||||||
concept SpecializationOf = IsSpecializationOf<T, S>;
|
concept SpecializationOf = IsSpecializationOf<T, S>;
|
||||||
|
|
||||||
@ -121,6 +124,7 @@ using AK::Concepts::IterableContainer;
|
|||||||
using AK::Concepts::IteratorFunction;
|
using AK::Concepts::IteratorFunction;
|
||||||
using AK::Concepts::IteratorPairWith;
|
using AK::Concepts::IteratorPairWith;
|
||||||
using AK::Concepts::OneOf;
|
using AK::Concepts::OneOf;
|
||||||
|
using AK::Concepts::OneOfIgnoringCV;
|
||||||
using AK::Concepts::SameAs;
|
using AK::Concepts::SameAs;
|
||||||
using AK::Concepts::Signed;
|
using AK::Concepts::Signed;
|
||||||
using AK::Concepts::SpecializationOf;
|
using AK::Concepts::SpecializationOf;
|
||||||
|
@ -593,6 +593,12 @@ inline constexpr bool IsHashCompatible<T, T> = true;
|
|||||||
template<typename T, typename... Ts>
|
template<typename T, typename... Ts>
|
||||||
inline constexpr bool IsOneOf = (IsSame<T, Ts> || ...);
|
inline constexpr bool IsOneOf = (IsSame<T, Ts> || ...);
|
||||||
|
|
||||||
|
template<typename T, typename U>
|
||||||
|
inline constexpr bool IsSameIgnoringCV = IsSame<RemoveCV<T>, RemoveCV<U>>;
|
||||||
|
|
||||||
|
template<typename T, typename... Ts>
|
||||||
|
inline constexpr bool IsOneOfIgnoringCV = (IsSameIgnoringCV<T, Ts> || ...);
|
||||||
|
|
||||||
}
|
}
|
||||||
using AK::Detail::AddConst;
|
using AK::Detail::AddConst;
|
||||||
using AK::Detail::AddConstToReferencedType;
|
using AK::Detail::AddConstToReferencedType;
|
||||||
@ -630,10 +636,12 @@ using AK::Detail::IsMoveAssignable;
|
|||||||
using AK::Detail::IsMoveConstructible;
|
using AK::Detail::IsMoveConstructible;
|
||||||
using AK::Detail::IsNullPointer;
|
using AK::Detail::IsNullPointer;
|
||||||
using AK::Detail::IsOneOf;
|
using AK::Detail::IsOneOf;
|
||||||
|
using AK::Detail::IsOneOfIgnoringCV;
|
||||||
using AK::Detail::IsPOD;
|
using AK::Detail::IsPOD;
|
||||||
using AK::Detail::IsPointer;
|
using AK::Detail::IsPointer;
|
||||||
using AK::Detail::IsRvalueReference;
|
using AK::Detail::IsRvalueReference;
|
||||||
using AK::Detail::IsSame;
|
using AK::Detail::IsSame;
|
||||||
|
using AK::Detail::IsSameIgnoringCV;
|
||||||
using AK::Detail::IsSigned;
|
using AK::Detail::IsSigned;
|
||||||
using AK::Detail::IsSpecializationOf;
|
using AK::Detail::IsSpecializationOf;
|
||||||
using AK::Detail::IsTrivial;
|
using AK::Detail::IsTrivial;
|
||||||
|
Loading…
Reference in New Issue
Block a user