diff --git a/include/stdx/utility.hpp b/include/stdx/utility.hpp index d040bf7..910622e 100644 --- a/include/stdx/utility.hpp +++ b/include/stdx/utility.hpp @@ -145,6 +145,8 @@ struct from_any { constexpr operator int() const { return 0; } }; +struct value_marker {}; + struct type_val { template >> @@ -152,6 +154,14 @@ struct type_val { return t; } friend constexpr auto operator+(type_val const &f) -> type_val { return f; } + + template >> + friend constexpr auto operator*(T, U const &) -> value_marker { + return {}; + } + friend constexpr auto operator*(type_val const &f) -> type_val { return f; } + // NOLINTNEXTLINE(google-explicit-constructor) template constexpr operator T() const { if constexpr (std::is_default_constructible_v) { @@ -164,7 +174,7 @@ struct type_val { }; template constexpr inline auto is_type = true; -template <> constexpr inline auto is_type = false; +template <> constexpr inline auto is_type = false; class cx_base { struct unusable {}; @@ -226,8 +236,8 @@ template constexpr auto is_ct_v = is_ct_v; #ifndef STDX_IS_TYPE #define STDX_IS_TYPE(...) \ - ::stdx::cxv_detail::is_type<__typeof__(::stdx::cxv_detail::from_any( \ - __VA_ARGS__))> + ::stdx::cxv_detail::is_type #endif #ifndef CX_VALUE