模板,Templates and GP
模板,Templates and GP
Item 41:了解隐式接口和编译期多态 Understand implicit interfaces and compile-time polymorphism.
- 隐式接口和编译期多态(和RTTI的区别?)
Item 42:了解typename的双重意义 Understand the two meanings of typename.
- typename和class关键字, typename关键字的双重定义
Item 43:学习处理模板化基类内的名称 Know how to access names in templatized base classes.
- 如何处理模板化基类的里面的名称
Item 44:将与参数无关的代码抽离templates Factor parameter-independent code out of templates.
- 参数无关的代码, 抽离template
Item 45:运用成员函数模板接受所有兼容类型 Use member function templates to accept"all compatible types."
- 使用成员函数模板来接受所有兼容的类型
Item 46:需要类型转换时请为模板定义非成员函数 Define non-member functions inside templates when type conversions are desired.
- 需要类型转换的时候, 为模板定义一个非成员函数
- 使用traits来表现模板里面的类型信息
- 什么是template元编程