摘要: array是固定大小的数组,和我们用的 [ ] 形式数组差不多。 特点: 1. 只保存里面元素,连数组大小都不保存 Internally, an array does not keep any data other than the elements it contains (not even it 阅读全文
posted @ 2020-07-17 13:57 goodluck14 阅读(218) 评论(0) 推荐(0) 编辑
摘要: STL 主要包括6大组件,容器(Containers),算法(Algorithms),迭代器(Iterators),函数对象(Functors)(也称仿函数),分配器(Allocators),适配器(Adapters)。 容器,包含顺序容器,关联容器(有序与无序),容器适配器 顺序容器用数组或者链表 阅读全文
posted @ 2020-07-17 13:13 goodluck14 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 1 函数模板 #include <iostream> using namespace std; template <typename T> T square(T a) { return a * a; } int main(void) { cout << square<int>(3) << endl; 阅读全文
posted @ 2020-07-17 11:56 goodluck14 阅读(198) 评论(0) 推荐(0) 编辑