C++ STL标准库函数

参考链接

0 前言:

平时STL自己用的很少,很多库函数都不是很熟悉,趁着最近有空,将STL的知识学习一下。主要学习一下,pair,vector,set,vector,stack,queue,map,string.

1 pair

位于头文件< iostream>中用来表示一个二元组或元素对
1.1 使用pair
定义一个pair对象表示一个平面面坐标点:

pair<double, double> p;
cin >> p.first >> p.second;

2.1排序

int cmp(pair<int,int > a,pair<int ,int > b){
    return a.second<b.second;
}

2.vector

STL vector

3.set (multiset)

STL set

4.map

STL map

5.queue(priority_queue)

STL queue and priority_queue

6.stack

STL stack

7.lower_bound upper_bound and binary_search()

STL lower_bound upper_bound and binary_search

猜你喜欢

转载自blog.csdn.net/qq_37360631/article/details/81299507