Template template parameter causing compiler error in clang
I have a template that compiles to MSVC (2017) but doesn't work in clang (4.0):
#include <utility>
#include <type_traits>
template <template <typename U, U, U> class, typename, typename>
struct meta_zip;
template <template <typename U, U, U> class OP, typename TA, TA... As, typename TB, TB... Bs>
struct meta_zip<OP, std::integer_sequence<TA, As...>, std::integer_sequence<TB, Bs...>>
{
using common_type = typename std::common_type<TA, TB>::type;
using type = std::integer_sequence<common_type, OP<common_type, As, Bs>::value...>;
};
template <template <typename U, U, U > class OP, typename A, typename B>
using meta_zip_t = typename meta_zip<OP, A, B>::type;
namespace impl
{
template <typename T, T A, T B>
using meta_zip_add = std::integral_constant<T, (A + B)>;
}
template <typename A, typename B>
using meta_zip_add = meta_zip<impl::meta_zip_add, A, B>;
template <typename A, typename B>
using meta_zip_add_t = typename meta_zip_add<A, B>::type;
template <int width>
class blend_low
{
private:
using counter1 = std::make_integer_sequence<int, 3>;
using counter2 = std::make_integer_sequence<int, 3>;
public:
using value = meta_zip_add_t<counter1, counter2>;
};
int main()
{
static constexpr auto foo = blend_low<4>::value();
return EXIT_SUCCESS;
}
I'm fairly new to templates and don't know how to rework OP
to make it work. I tried OP<U, U, U>
it but it doesn't seem to help.
+3
source to share
No one has answered this question yet
Check out similar questions: