摘要:
1.仿函数 /* 仿函数:让类的对象模仿函数调用的行为(函数名()) //对象() 关键点在于重载() 仿函数一般来说用来做比较准则 充当for_each的参数 No.1 自己写仿函数 */ class Sum { public: int operator()(const int a, const 阅读全文
摘要:
1.迭代器 迭代器:可以说是一种访问容器的一个桥梁,类中类的一个对象,去模仿指针的行为 迭代器分类: 按照定义方式分类: + 正向迭代器: + 容器名::iterator iter; + begin(); + end(); + 常量正向迭代器 + 容器名::const_iterator citer 阅读全文
摘要:
1.initalizer_list(列表) template <class _Ty> class MyVector { public: MyVector(int size) :curSize(0) { dataMemory = new _Ty[size]; } MyVector(initialize 阅读全文
摘要:
1.tuple /* 可变参模板类 参数个数、数据类型不限定 */ void testCreateTuple() { //正常创建 tuple<int, string, double, float, int> tup1; tuple<int, string, string, double> tup2 阅读全文