// Listing 7: Variadic Templates #include #include #include template int f(Args... args){ return (sizeof... args); } template void printCommaSeparatedList(T value) { std::cout< void printCommaSeparatedList(First first,Rest ... rest) { std::cout< intVec= {1,2,3,4,5}; std::cout << "f() has " << f() << " arguments\n"; std::cout << "f(42, 3.14) has " << f(42, 3.14) << " arguments\n"; std::cout << "f(\"one\",\"two\",\"three\",\"four\") has " << f("one","two","three","four" ) << " arguments\n"; std::cout << "f(intVec,intList) has " << f(intVec,intList) << " arguments\n\n"; printCommaSeparatedList("Only primary template used."); printCommaSeparatedList(42,"hello",2.3,'a'); std::cout << "\n"; }