Date: Mon, 19 Sep 2022 20:29:17 +0200
Hi Frederick,
On Sat, Sep 10, 2022 at 10:00:04AM +0100, Frederick Virchanza Gotham via Std-Proposals wrote:
> If you can see my previous post on this mailing list about "common_base"
> for "std::variant", you'll see how I check at compile-time if a concrete
> class is a specialisation of a given template class.
>
> Well there should be "std::is_specialization_of" in the C++ Standard as
> follows:
>
> #include <type_traits>
>
> template<typename Test, template<typename...> class Ref>
> struct is_specialization_of : std::false_type {};
>
> template<template<typename...> class Ref, typename... Args>
> struct is_specialization_of<Ref<Args...>, Ref>: std::true_type {};
>
> Also there should be:
>
> template<typename Test, template<typename...> class Ref>
> inline constexpr bool is_specialization_of_v =
> is_specialization_of<Test,Ref>::value;
This looks like
P2098 std::is_specialization_of
See https://github.com/cplusplus/papers/issues/812 why it's not in the
Standard.
Cheers,
Mark
On Sat, Sep 10, 2022 at 10:00:04AM +0100, Frederick Virchanza Gotham via Std-Proposals wrote:
> If you can see my previous post on this mailing list about "common_base"
> for "std::variant", you'll see how I check at compile-time if a concrete
> class is a specialisation of a given template class.
>
> Well there should be "std::is_specialization_of" in the C++ Standard as
> follows:
>
> #include <type_traits>
>
> template<typename Test, template<typename...> class Ref>
> struct is_specialization_of : std::false_type {};
>
> template<template<typename...> class Ref, typename... Args>
> struct is_specialization_of<Ref<Args...>, Ref>: std::true_type {};
>
> Also there should be:
>
> template<typename Test, template<typename...> class Ref>
> inline constexpr bool is_specialization_of_v =
> is_specialization_of<Test,Ref>::value;
This looks like
P2098 std::is_specialization_of
See https://github.com/cplusplus/papers/issues/812 why it's not in the
Standard.
Cheers,
Mark
Received on 2022-09-19 18:29:21