跳到正文

算法·理论

2026/09/13朱文杰老师周日三点半C++STL容器综合

liuliwei约 2 分钟
原文
文章信息与版本

文章信息

发布
2026年9月13日
收录
2026年9月29日
更新
2026年11月14日
篇幅
约 2 分钟
获赞
1

版本

  1. v2当前
  2. v1

STL容器:

学过:

代码
vector,deque,list,array       序列容器
set,map                       非序列容器
stack,queue,priority_queue    容器适配器

c++文档: https://zh.cppreference.com


C++
struct Node{
	int a,b;
};
Node node;

node的a和b为随机值


C++
struct Node{
	int a,b;
	Node(int a=123,int b=456){
		cout << "111" << endl;
        this->a=a;
        this->b=b;
	}
};
Node node;

或

C++
struct Node{
	int a,b;
	Node(int _a=123,int _b=456):a(_a),b(_b){
  
    }
};
Node node;
可以不写node初始值
C++
vector<bool>既不是vector也不是bool

.bmp

新建位图图像.bmp


迭代器

代码
指针:记录元素在内存中的地址        
下标:记录元素在数组中的次序
迭代器:记录元素在容器中的索引

bitset

新建位图图像 (2).jpg

新建位图图像 (3).jpg

原文
存档评论1 条抓取于