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

· · 算法·理论

STL容器:

学过:

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

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

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

node的a和b为随机值

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

或

struct Node{
    int a,b;
    Node(int _a=123,int _b=456):a(_a),b(_b){

    }
};
Node node;
可以不写node初始值
vector<bool>既不是vector也不是bool

迭代器

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

bitset