本文参考了:
- 侯捷老师的c++讲义。
#include <iostream>
#include <bitset>
using namespace std;
void printX()
{
/*nothing.*/
}
template <typename T, typename... Types>
void printX(const T& firstArg, const Types&... args)
{
cout << firstArg << endl;
printX(args...);
}
int main()
{
printX(7.5, "hello", bitset<16>(377), 42);
return 0;
}
执行结果:
7.5
hello
0000000101111001
42