Basic template terminology
来源:互联网 发布:淘宝达人 开店 编辑:程序博客网 时间:2024/06/06 17:53
是class template还是template class
C++中struct,classes,unions统称为class types
class types包括unions,而class不包括unions
具现化(Instantiation)与特化(Specialization)
- 在template中,以实际值作为template arguments,从而产生常规的class,function或者member function,这个过程为template的具现化
- 显示特化,偏特化,当我们讨论特化时,常把最广泛的那个template称为primary template(柱模板或者原始模板)
宣告和定义
在两种情况下宣告会变成定义
- 当他们的细节被写明白
- 当编译器必须为变量配置内存空间
单一定义规则(One-definition rule,ODR)
基本规则
- Non-inline函数和成员函数,以及全局变量和static成员变量,在整个程序中只能定义一次
- class型别(包括unions)及inline函数,在每个编译单元中最多只能定义一次,如果跨越不同的编译单元,其定义必须完全相同。
- 编译单元是指源代码中所设置的所有文件,也就是#include指令所包含的所有文档。
- 可链接物是:non-inline函数或non-inline成员函数,全局变量,static成员变量,以及所有由template代码产生的上述四个物体(entity)
Template arguments(模板引数) VS template parameters(模板参数)
template <typename T, int n>class Array{public: T array[N];}class DoubleArray{public: double array[10];}Array<double, 10> ad;
- 代码最后一行,template名称后紧跟角括号括起来的template arguments
- 无论这些template arguments本身是否依赖template parameters,我们把template name + 大括号括起的template arguments组合体称为template-id
在学界,引数(arguments)有时被称为实际参数(actual parameters),参数(parameters)有时被称为形式参数(formal parameters)
阅读全文
0 0
- Basic template terminology
- Basic Terminology
- Understanding basic database terminology
- Item 45. 模板术语(Template Terminology )
- 《Understanding Linux networking 》1.1 Basic Terminology
- terminology
- 9.template -- basic concepts
- Some basic details of template in C++
- Return to the Basic - 模板(template)
- A Basic Template For Assembly Language Programs
- C++ Terminology
- Terminology Extraction
- Kernel Terminology
- JAZZ Terminology
- Alsa Terminology
- PRINCE2 terminology
- H264 Terminology
- Debugging Terminology
- Python 多线程学习
- 增长引擎
- 技术向:一文读懂卷积神经网络CNN
- 01_Scala基础语法
- 在Ubuntu 14.04 64bit上编译并研究State Threads网络线程库源码
- Basic template terminology
- IP对移动游戏领域的价值在哪里?
- C语言实现判断大端小端存储方式的代码
- java中的BigDecimal和String的相互转换
- 马云:阿里必须是一家创造未来的公司,必须成为国家和世界创新的发动机
- David Silver强化学习课程笔记(二)
- POJ 2774 Long Long Message
- 安卓自定义分页view
- idea springboot 热部署