I want to pass a partial template specialization to template template parameter but I'm getting an error. Im not sure why excatly this doesent work.
template<template<typename, int> class V, typename T, int N, int... Indexes>
class Swizzle
{
// ...
};
template<typename T, int N>
struct Vector;
template<typename T>
struct Vector<T, 3>
{
// ...
union
{
// ...
Swizzle<Vector, T, 3, 0, 0, 0> xxx;
};
};
Error:
'Vector': invalid template argument for template parameter 'V', expected a class template 'Swizzle': use of class template requires template argument list
Problem appears only on MSVC
union
in C++ code is not a best idea. Note there isstd::variant
(c++17) which is modern version of theunion
. – Marek R