[*] AuIsBaseOfTemplate_v
This commit is contained in:
parent
395dd0aa97
commit
8e9fd74b6f
@ -25,13 +25,13 @@ static AuConditional_t<AuIsPointer_v<T>, T, T *> AuStaticCast(Z *other)
|
||||
return static_cast<AuConditional_t<AuIsPointer_v<T>, T, T *>>(other);
|
||||
}
|
||||
|
||||
template<class T, class Z, AU_TEMPLATE_ENABLE_WHEN(!AuIsBaseOfTemplate<AURORA_RUNTIME_AU_SHARED_PTR, Z>::type)>
|
||||
template<class T, class Z, AU_TEMPLATE_ENABLE_WHEN(!AuIsBaseOfTemplate_v<AURORA_RUNTIME_AU_SHARED_PTR, Z>)>
|
||||
AuConditional_t<AuIsReference_v<T>, T, T &> AuStaticCast(Z &other)
|
||||
{
|
||||
return static_cast<AuConditional_t<AuIsReference_v<T>, T, T &>>(other);
|
||||
}
|
||||
|
||||
template<class T, class Z, AU_TEMPLATE_ENABLE_WHEN(!AuIsBaseOfTemplate<AURORA_RUNTIME_AU_SHARED_PTR, Z>::type)>
|
||||
template<class T, class Z, AU_TEMPLATE_ENABLE_WHEN(!AuIsBaseOfTemplate_v<AURORA_RUNTIME_AU_SHARED_PTR, Z>)>
|
||||
static AuConditional_t<AuIsReference_v<T>, T, T &&> AuStaticCast(Z &&other)
|
||||
{
|
||||
return static_cast<AuConditional_t<AuIsReference_v<T>, T, T &&>>(other);
|
||||
@ -49,13 +49,13 @@ AuConditional_t<AuIsPointer_v<T>, T, T *> AuConstCast(Z *other)
|
||||
return const_cast<AuConditional_t<AuIsPointer_v<T>, T, T *>>(other);
|
||||
}
|
||||
|
||||
template<class T, class Z, AU_TEMPLATE_ENABLE_WHEN(!AuIsBaseOfTemplate<AURORA_RUNTIME_AU_SHARED_PTR, Z>::type)>
|
||||
template<class T, class Z, AU_TEMPLATE_ENABLE_WHEN(!AuIsBaseOfTemplate_v<AURORA_RUNTIME_AU_SHARED_PTR, Z>)>
|
||||
AuConditional_t<AuIsReference_v<T>, T, T &> AuConstCast(Z &other)
|
||||
{
|
||||
return const_cast<AuConditional_t<AuIsReference_v<T>, T, T &>>(other);
|
||||
}
|
||||
|
||||
template<class T, class Z, AU_TEMPLATE_ENABLE_WHEN(!AuIsBaseOfTemplate<AURORA_RUNTIME_AU_SHARED_PTR, Z>::type)>
|
||||
template<class T, class Z, AU_TEMPLATE_ENABLE_WHEN(!AuIsBaseOfTemplate_v<AURORA_RUNTIME_AU_SHARED_PTR, Z>)>
|
||||
AuConditional_t<AuIsReference_v<T>, T, T &&> AuConstCast(Z &&other)
|
||||
{
|
||||
return const_cast<AuConditional_t<AuIsReference_v<T>, T, T &&>>(other);
|
||||
|
@ -211,14 +211,17 @@ struct AuConditional<false, T, T2>
|
||||
template<bool Test, class T, class T2>
|
||||
using AuConditional_t = typename AuConditional<Test, T, T2>::type;
|
||||
|
||||
template<template<typename...> class base, typename derived>
|
||||
struct is_base_of_template_impl_au
|
||||
template<template<typename...> class Base, typename Derived>
|
||||
struct AuIsBaseOfTemplateImpl
|
||||
{
|
||||
template<typename... Ts>
|
||||
static constexpr AuTrueType test(const base<Ts...> *);
|
||||
static constexpr AuFalseType test(...);
|
||||
using type = decltype(test(std::declval<AuRemoveReference_t<derived> *>()));
|
||||
static constexpr AuTrueType Test(const Base<Ts...> *);
|
||||
static constexpr AuFalseType Test(...);
|
||||
using type = decltype(Test(std::declval<AuRemoveReference_t<Derived> *>()));
|
||||
};
|
||||
|
||||
template<template <typename...> class base, typename derived>
|
||||
using AuIsBaseOfTemplate = typename is_base_of_template_impl_au<base, derived>::type;
|
||||
using AuIsBaseOfTemplate = typename AuIsBaseOfTemplateImpl<base, derived>::type;
|
||||
|
||||
template<template <typename...> class base, typename derived>
|
||||
inline constexpr bool AuIsBaseOfTemplate_v = AuIsBaseOfTemplateImpl<base, derived>::type::value;
|
Loading…
Reference in New Issue
Block a user