You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adjust to new style of using one function for a match and series
of constexpr ifs.
There is a possibility to extend is() for matching std::integer_sequence
but unfortunatelly clang is not support it (gcc & msvc do).
template <template <typename, typename, typename...> class C, typename X>
constexpr auto is( X const& ) {
if constexpr (specialization_of_template<X, C>) {
return std::true_type{};
}
else {
return std::false_type{};
}
}
template <template <typename, auto...> class C, typename X>
constexpr auto is( X const& ) {
if constexpr (specialization_of_template_type_and_nttp<X, C>) {
return std::true_type{};
}
else {
return std::false_type{};
}
}
Alternatively we can support more matches for gcc & msvc by providing:
#if defined(__clang__)
template <template <typename...> class C, typename X>
#else
// allow us to support std::integer_sequence on gcc and msvc
template <template <typename, typename, typename...> class C, typename X>
#endif
constexpr auto is( X const& ) {
if constexpr (specialization_of_template<X, C>) {
return std::true_type{};
}
else {
return std::false_type{};
}
}
#if defined(__clang__)
template <template <typename, auto> class C, typename X>
#else
// allow us to support std::integer_sequence on gcc and msvc
template <template <typename, auto...> class C, typename X>
#endif
constexpr auto is( X const& ) {
if constexpr (specialization_of_template_type_and_nttp<X, C>) {
return std::true_type{};
}
else {
return std::false_type{};
}
}
0 commit comments