重複の可能性:
括弧は引数として任意の識別子を取ることができますか?C ++
私の質問は、パラメータpack'unpack'演算子の使用について...
です。次のコードフラグメントは、g ++ 4.7.1でコンパイラエラー(最後の行の「...」の前に期待されるパラメータパック)を示しますが、なぜだろうと思います。
template<class T> struct type_wrapper
{ typedef T type; };
template<class...Ts> struct variadic_wrapper { };
// This compiles:
template<class...Ts> struct variadic_type_wrapper
{ typedef variadic_wrapper<typename type_wrapper<Ts>::type...> type; };
// Parentheses screw it up:
// Error: expected parameter pack before '...'
template<class...Ts> struct variadic_type_wrapper
{ typedef variadic_wrapper<(typename type_wrapper<Ts>::type)...> type; };
式は(...)
、基になる型のアリティを隠していますか?これを片付けてくれてありがとう!