revision #1: 更新第二章中已维护的代码

This commit is contained in:
Changkun Ou
2018-04-02 00:28:05 +02:00
parent 11efa38dba
commit 838d30ef5a
28 changed files with 460 additions and 111 deletions

21
code/2/todo/2.xxx.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include <iostream>
template<typename T0>
void printf(T0 value) {
std::cout << value << std::endl;
}
template<typename T, typename... Args>
void printf(T value, Args... args) {
std::cout << value << std::endl;
printf(args...);
}
template<typename T0, typename... T>
void printf_short(T0 t0, T... t) {
std::cout << t0 << std::endl;
if constexpr (sizeof...(t) > 0) printf(t...);
}
int main() {
printf_short(1, 2, "123", 1.1);
return 0;
}