CppTemplateTutorial’ Notes
这里说的几个概念都是什么意思:
当然和“设计模式”一样,模板在实际应用中,也会有一些固定的需求和解决方案。比较常见的场景包括:
- 泛型(最基本的用法
- 通过类型获得相应的信息(型别萃取)
- 编译期间的计算
- 类型间的推导和变换(从一个类型变换成另外一个类型,比如boost::function)
但是模板和宏也有很大的不同,否则此文也就不能成立了。模板最大的不同在于它是“可以运算”的。
其他
- https://github.com/mattbierner/STT-C-Compile-Time-Snake : 简单看了下,无趣
- https://www.zhihu.com/column/c_1306966457508118528
- https://www.zhihu.com/question/21376384/answer/3459052295
- 逆天
- template 如何约束类型:C++20 concept 机制
-
https://en.cppreference.com/w/cpp/meta
-
https://stackoverflow.com/questions/20063184/template-alias-for-template-member-class
- 在 template 中 typename 和 class 的区别
- https://stackoverflow.com/questions/2023977/difference-of-keywords-typename-and-class-in-templates
本站所有文章转发 CSDN 将按侵权追究法律责任,其它情况随意。