Skip to content

Commit ba8bb7f

Browse files
committed
🔧 [apply_t] fixup
1 parent fa5dc5b commit ba8bb7f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

mp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,17 @@ inline constexpr auto apply_v = []<size_t... Ns>(utility::index_sequence<Ns...>)
195195
* static_assert(typeid(variant<int>) == typeid(apply_t<variant, [] { return vector{meta<int>}; }>));
196196
* @endcode
197197
*/
198-
template<template<class...> class T, auto V>
199-
using apply_t = decltype(apply_v<T, V>());
198+
#if defined(__clang__) || defined(_MSC_VER)
199+
template<template<class...> class R, auto V>
200+
using apply_t = decltype(apply<R>([] { return V; }));
201+
#else
202+
namespace detail {
203+
template<template<class...> class R, auto V, size_t... Ns>
204+
using apply_t = R<type_of<V[Ns]>...>;
205+
} // namespace detail
206+
template<template<class...> class R, auto V>
207+
using apply_t = detail::apply_t<R, V, __integer_pack(V.size())...>;
208+
#endif
200209

201210
/**
202211
* Invokes function with compile-time info based on run-time info

0 commit comments

Comments
 (0)