随笔分类 - C++
摘要:1. 迭代器简介 为了提高C++编程的效率,STL(Standard Template Library)中提供了许多容器,包括vector、list、map、set等。然而有些容器(vector)可以通过下标索引的方式访问容器里面的数据,但是大部分的容器(list、map、set)不能使用这种方式访
阅读全文
摘要:本文主要介绍const修饰符在C++中的主要用法,下面会从两个方面进行介绍: 类定义中使用const 、 非类定义中使用const 1. 非类定义中使用const 非类定义中使用const是指:在除了类定义以外的场景中使用const。 1.1 变量 顶层const:变量本身是个常量 底层const:
阅读全文
摘要:1. 问题代码 C++ bool find_int(const std::vector::iterator &begin, const std::vector::iterator &end, int v) C++ bool find_int(std::vector::iterator begin,
阅读全文