mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05: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
b7e22f0916
commit
e8b2d35410
Notes:
github-actions[bot]
2024-12-04 16:47:14 +00:00
Author: https://github.com/yyny Commit: https://github.com/LadybirdBrowser/ladybird/commit/e8b2d354107 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2454 Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 14 additions and 0 deletions
|
@ -456,6 +456,19 @@ using AssertSize = __AssertSize<T, ExpectedSize, sizeof(T)>;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline constexpr bool IsPOD = __is_pod(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>
|
template<typename T>
|
||||||
inline constexpr bool IsTrivial = __is_trivial(T);
|
inline constexpr bool IsTrivial = __is_trivial(T);
|
||||||
|
|
||||||
|
@ -654,6 +667,7 @@ using AK::Detail::IsSame;
|
||||||
using AK::Detail::IsSameIgnoringCV;
|
using AK::Detail::IsSameIgnoringCV;
|
||||||
using AK::Detail::IsSigned;
|
using AK::Detail::IsSigned;
|
||||||
using AK::Detail::IsSpecializationOf;
|
using AK::Detail::IsSpecializationOf;
|
||||||
|
using AK::Detail::IsTemplateBaseOf;
|
||||||
using AK::Detail::IsTrivial;
|
using AK::Detail::IsTrivial;
|
||||||
using AK::Detail::IsTriviallyAssignable;
|
using AK::Detail::IsTriviallyAssignable;
|
||||||
using AK::Detail::IsTriviallyConstructible;
|
using AK::Detail::IsTriviallyConstructible;
|
||||||
|
|
Loading…
Reference in a new issue