refactor: simplify is_derived_from_specialization_of

This commit is contained in:
Johel Ernesto Guerrero Peña
2020-09-07 01:14:14 -04:00
committed by Mateusz Pusz
parent e30aa9c4a0
commit 7c00b196a3

View File

@@ -68,16 +68,12 @@ inline constexpr bool is_specialization_of<Type<Params...>, Type> = true;
// is_derived_from_specialization_of // is_derived_from_specialization_of
namespace detail { namespace detail {
template<template<typename...> typename Type> template<template<typename...> typename Type, typename... Params>
struct is_derived_from_specialization_of_impl { void to_base_specialization_of(const volatile Type<Params...>*);
template<typename... Params>
static constexpr std::true_type check_base(const Type<Params...>&);
static constexpr std::false_type check_base(...);
};
} // namespace detail } // namespace detail
template<typename T, template<typename...> typename Type> template<typename T, template<typename...> typename Type>
inline constexpr bool is_derived_from_specialization_of = decltype(detail::is_derived_from_specialization_of_impl<Type>::check_base(std::declval<T>()))::value; concept is_derived_from_specialization_of = requires { detail::to_base_specialization_of<Type>(std::declval<const volatile T*>()); };
} // namespace units } // namespace units