01 2022 档案
摘要:重写 print 函数 #include<iostream> using namespace std; void printfX(const char *s) { while (*s) { if (*s == '%' && *(++s) != '%') throw "invalid format s
阅读全文
摘要:使用可变参数模板重写print #include<iostream> #include<bitset> using namespace std; void printX() { } template<typename T, typename... Types> void printX(const T
阅读全文
摘要:1. 为什么要使用lambda + 就地匿名的定义一个目标函数或者函数对象,不需要额外的再写一个命名函数或者函数对象,以更直接的方式去写函数,可以调高程序的可读性和可维护性。 + 简洁:不要额外的的再写一个函数或者函数对象,避免了代码膨胀或者功能分散。 + 在需要的时间或者地点实现功能闭包,是程序更
阅读全文