1. 程式人生 > >C++ STL標準庫函式

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

3.set (multiset)

4.map

5.queue(priority_queue)

6.stack

7.lower_bound upper_bound and binary_search()