也许我在这里很天真,但我相信以下代码应该编译:
template <typename ... T>
struct Test {
std::tuple<T> foo;
};
int main() {
struct Test<int, long> test;
return 0;
}
相反,g++ 抱怨:
test.cpp:5: error: parameter packs not expanded with '...':
test.cpp:5: note: 'T'
我缺少什么?
您可以通过扩展包来做到这一点...
:
template <typename... T>
struct Test
{
std::tuple<T...> foo;
// ^^^^
};
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)