这是 gcc 错误还是参数包的某种错误使用?
(用 gcc 4.6.3 编译 :)
#include <iostream>
template<class...Ts> struct tuple{};
template<class...>class test;
template< template <class...> class tp,
class...arg1Ts,
class...arg2Ts>
class test<tp<arg1Ts...>,tp<arg2Ts...>>{
public:
void test1(arg1Ts... arg1s,arg2Ts... arg2s){
std::cout<<sizeof...(arg1s); //Why is this 2? Why not 0?
std::cout<<sizeof...(arg2s); //2 ok
}
};
int main(){
test<tuple<>,tuple<char,int>> t1; //(arg1Ts... = empty), (arg2Ts... = char,int)
t1.test1('a',2); //prints 22, not 02
}