#include <iostream>
#include <typeinfo>
#include <string>
template<typename T,typename ... U>
void print(T t, U... u) {
if constexpr (sizeof...(U) == 0) {
std::cout << t << std::endl;
}
else {
std::cout << t << ", ";
print(u...);
}
}
int main() {
int a = 3;
char b = 'B';
std::string s = "hello world";
print(1,2,3,"hello");
print(a, b, s);
return 0;
}
c++17之parameter packet 参数包
最新推荐文章于 2023-11-20 18:43:28 发布