mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 15:10:19 +00:00
AK: Add IsTemplateBaseOf<Base, Derived>
concept
This concept checks if any specialization of `Base<...>` is a base class of `Derived`.
This commit is contained in:
parent
1a03a27c86
commit
b09595e147
1 changed files with 14 additions and 0 deletions
|
@ -456,6 +456,19 @@ using AssertSize = __AssertSize<T, ExpectedSize, sizeof(T)>;
|
|||
template<typename T>
|
||||
inline constexpr bool IsPOD = __is_pod(T);
|
||||
|
||||
template<template<typename...> class Base, typename Derived>
|
||||
struct __IsTemplateBaseOf {
|
||||
template<typename... Args>
|
||||
static TrueType test(Base<Args...> const*);
|
||||
|
||||
static FalseType test(...);
|
||||
|
||||
using type = decltype(test(declval<Derived*>()));
|
||||
};
|
||||
|
||||
template<template<typename...> class Base, typename Derived>
|
||||
inline constexpr bool IsTemplateBaseOf = __IsTemplateBaseOf<Base, Derived>::type::value;
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool IsTrivial = __is_trivial(T);
|
||||
|
||||
|
@ -654,6 +667,7 @@ using AK::Detail::IsSame;
|
|||
using AK::Detail::IsSameIgnoringCV;
|
||||
using AK::Detail::IsSigned;
|
||||
using AK::Detail::IsSpecializationOf;
|
||||
using AK::Detail::IsTemplateBaseOf;
|
||||
using AK::Detail::IsTrivial;
|
||||
using AK::Detail::IsTriviallyAssignable;
|
||||
using AK::Detail::IsTriviallyConstructible;
|
||||
|
|
Loading…
Reference in a new issue