@@ -145,13 +145,23 @@ struct from_any {
145
145
constexpr operator int () const { return 0 ; }
146
146
};
147
147
148
+ struct value_marker {};
149
+
148
150
struct type_val {
149
151
template <typename T, typename U,
150
152
typename = std::enable_if_t <same_as_unqualified<type_val, U>>>
151
153
friend constexpr auto operator +(T t, U const &) -> T {
152
154
return t;
153
155
}
154
156
friend constexpr auto operator +(type_val const &f) -> type_val { return f; }
157
+
158
+ template <typename T, typename U,
159
+ typename = std::enable_if_t <same_as_unqualified<type_val, U>>>
160
+ friend constexpr auto operator *(T, U const &) -> value_marker {
161
+ return {};
162
+ }
163
+ friend constexpr auto operator *(type_val const &f) -> type_val { return f; }
164
+
155
165
// NOLINTNEXTLINE(google-explicit-constructor)
156
166
template <typename T> constexpr operator T () const {
157
167
if constexpr (std::is_default_constructible_v<T>) {
@@ -164,7 +174,7 @@ struct type_val {
164
174
};
165
175
166
176
template <typename > constexpr inline auto is_type = true ;
167
- template <> constexpr inline auto is_type<from_any > = false ;
177
+ template <> constexpr inline auto is_type<value_marker > = false ;
168
178
169
179
class cx_base {
170
180
struct unusable {};
@@ -226,8 +236,8 @@ template <typename T> constexpr auto is_ct_v<T const> = is_ct_v<T>;
226
236
227
237
#ifndef STDX_IS_TYPE
228
238
#define STDX_IS_TYPE (...) \
229
- ::stdx::cxv_detail::is_type<__typeof__(::stdx::cxv_detail::from_any( \
230
- __VA_ARGS__) )>
239
+ ::stdx::cxv_detail::is_type<decltype ((__VA_ARGS__) * \
240
+ ::stdx::cxv_detail::type_val{} )>
231
241
#endif
232
242
233
243
#ifndef CX_VALUE
0 commit comments