虽强调现代 C++,但同时对于老式模板写法也都会进行提及和教学。因为不体会老式语法和写法的折磨,没有办法理解新特性的价值与意义。 请确保您的编译器至少支持 C++20,优先使用 gcc13,clang16,msvc v19.latest。所有代码均测试三大编译器。
现代C++模板教程. Contribute to Mq-b/Modern-Cpp-templates-tutorial development by creating an account on GitHub.
直接[fork](https://github.com/Mq-b/Modern-Cpp-templates-tutorial/fork) 本仓库。在本地先新建分支,转到分支,在 homework 文件夹中的具体题目文件夹中新建自己的文件或文件夹,写好后,提出 pr。 直接[fork](https://github.com/Mq-b/Modern-Cpp-templates-tutorial/fork) 本仓库。在本地先新建分支,转到分...
现代C++模板教程. Contribute to Mq-b/Modern-Cpp-templates-tutorial development by creating an account on GitHub.
2. [`decltype(auto)`](https://zh.cppreference.com/w/cpp/language/auto) *如果返回类型没有使用 decltype(auto),那么推导遵循[模板实参推导](https://zh.cppreference.com/w/cpp/language/template_argument_deduction#.E5.85.B6.E4.BB.96.E8.AF.AD.E5.A2.83)的规则进行*”,我们上面的 `max` ...