> 原文出處:[實戰c++中的vector系列專欄文章](http://blog.csdn.net/column/details/wangshubovector.html)
> 作者:[王書博](http://blog.csdn.net/wangshubo1989)
**本系列文章經作者授權在看云整理發布,未經作者允許,請勿轉載!**
# 實戰c++中的vector系列
> 本專欄主要記錄和講訴實際工作中,關于vector的一些操作,一些tips和一些tricks.
- 前言
- 構造、operator=和assign區別
- 將迭代器轉換為索引
- copy set to vector(別混淆了reserve和resize)
- 使用vector構造二維數組
- 可怕的迭代器失效(vector重新申請內存)
- 可怕的迭代器失效之二(刪除vector中元素)
- vector<unique_ptr<>>初始化(所有權轉移)
- vector<unique_ptr<>>作為函數的參數
- vector<unique_ptr<>>賦值給vector<unique_ptr<>>
- creating vector of local structure、vector of structs initialization
- 知道emplace_back為何優于push_back嗎?
- emplace_back造成的引用失效
- vector的一些異常
- vector的遍歷(stl算法、vector迭代器(不要在循環中判斷不等于end())、operator[])
- 使用sort算法對vector進行排序(對vector<string>排序、使用穩定的排序std::stable_sort())
- vector應用之STL的find、find_if、find_end、find_first_of、find_if_not(C++11)
- 使用sort算法對vector<unique_ptr<string>>進行排序(sort函數“應輸入 2 個參數,卻提供了 3 個)
- 對vector<自定義類>使用std::find 和 std::find_if 算法