在浏览gcc当前新C++ 11标头的实现时,我偶然发现了"......"令牌.您可以检查,以下代码编译正常 [通过ideone.com].
template <typename T>
struct X
{ /* ... */ };
template <typename T, typename ... U>
struct X<T(U......)> // this line is the important one
{ /* ... */ };
Run Code Online (Sandbox Code Playgroud)
那么,这个令牌的含义是什么?
编辑:看起来如此修剪"......"的问题标题为"......",我的意思是"......".:)
在看这个问题的时候,我发现自己在cpp参考站点,我发现了一个奇怪的新手语法:
template<class Ret, class... Args>
struct is_function<Ret(Args......)volatile &&> : std::true_type {};
Run Code Online (Sandbox Code Playgroud)
是的,6个点!最初我认为这是一个拼写错误,但在再次检查libstdc ++ 源之后,例如在第444行:
template<typename _Res, typename... _ArgTypes>
struct is_function<_Res(_ArgTypes......) volatile &&> : public true_type { };
Run Code Online (Sandbox Code Playgroud)
这是一个有效的语法吗?点点,用于打包和解包参数包?6个点做什么?