STL基础

来源:互联网 发布:python json 查找 编辑:程序博客网 时间:2024/05/17 09:03

1  It's important to realize that these templates are not class and member function definitions. Rather, they are instructions to the C++ compiler about how to generate class and member function definitions.  所以, 模板类是在编译时被替换的, 当编译时, 参数会替换成实际参数, 就像宏的处理一样.

 

2  Unless you have a compiler that has implemented the new export keyword, placing the template member functions in a separate implementation file won't work. Because the templates aren't functions, they can't be compiled separately.   意思就是, 模板类不能像普通类那样, 声明在.H中, 实现在.CPP中. 而是声明和实现都必须要同一个头文件中.

 

3

Using a Template Class

原创粉丝点击