[英]C++ partial template template specialization
我想將部分模板特化傳遞給模板模板參數,但出現錯誤。 我不知道為什么這不工作。
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;
};
};
錯誤:
“Vector”:模板參數“V”的模板參數無效,需要類模板“Swizzle”:使用類模板需要模板參數列表
問題僅出現在MSVC 上
在類模板Vector
, Vector
既指模板實例的類型,也指模板本身。
template<class X, int M>
using Self = Vector<X,M>;
// ...
union
{
// ...
Swizzle<Self, T, 3, 0, 0, 0> xxx;
};
我懷疑 MSVC 在這里是錯誤的,但我不確定。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.