???????C++????????????STL???????STL????????????е????????????á??????????????????????????????д???????????????Ч?????????????????STL??????£??????????????vector????á?
????STL?????????????
?????????????Container??????????????????list??vector??deque??queue?????????????????????????????е????????????????????????????????
????????????????Iterator??:????????????ж?????????
??????????(Algorithm):?????????????е????????庯????
????????o???(Function object)??
?????塣????????????Adapter????
?????????????????(allocator)??
???????????????????????????????????????????????????????????vector??????????????????https://github.com/chenyufeng1991/STL_vector  ??vector??????????????飬???????????飬??????????????????????????????????????????С?????????????????????????????????β???????????????????????????????????????????????????????? #include <vector>????????????£?
??????1??vector?????
????vector<int> vec1; // ??????????vector
????vector<int> vec2(vec1); // ???????vector vec2??????vec1??????vec2
????vector<int> vec3(10); // ???????????n???????vector
????vector<int> vec4(10??0); // ????????10???????vector?????????????0
????????????????????????????????????vector??
??????2??push_back()??pop_back()?????????
????// ??vectorβ????????
????vec1.push_back(4);
????vec1.push_back(6);
????vec1.push_back(8);
????vec1.push_back(1);
????vec1.push_back(2);
????PrintVector(vec1);
????// ??vectorβ????????
????vec1.pop_back();
????PrintVector(vec1);
????// ??vector????????????????????vector???????????飬???????????????????????????????????
????// ??vector?????????????????????????
???????????push_back()???????vectorβ????????????pop_back???β??????????????????????????????????????????
??????3??[]??at()????λ???????
????// ?vector???λ???????
????cout << "??1λ??????????" << vec1.at(1) << endl;
????cout << "??1λ??????????" << vec1[1] << endl;
???????vector???????????????飬??????????????????
??????4??begin()??end()??????????β???????
????void PrintVector(vector<int> ve)
????{
????cout << "Vector?е????????";
????vector<int>::iterator veIterator;
????for (veIterator = ve.begin(); veIterator < ve.end(); veIterator++)
????{
????cout << *veIterator << " ";
????}
????cout << endl;
????}
????????????vector?е?????????????begin().end()??????????????????????б?????????????????????????begin()??end()????????????β?????????????vector?е???????????
??????5??back()??front()?????????????β?????
????// ????β???????????
????cout << "β???????????" << vec1.back() << endl;
????// ????????????????
????cout << "????????????" << vec1.front() << endl;
??????6??max_size()??vector???????????size():vector?????????????
????cout << "vector?е?????????" << vec1.max_size() << endl;
????cout << "vector?е??????????" << vec1.size() << endl;
??????7??empty()???ж?vector??????
????cout << "vector???????" << vec1.empty() << endl;
???????????????1.??????0??
??????8??swap():????????vector?е????
??????9??sort():??vector????????reverse()????vector????????
????// ??vector????????????
????sort(vec1.begin()?? vec1.end());
????PrintVector(vec1);
????// ??vector???н???????
????reverse(vec1.begin()?? vec1.end());
????PrintVector(vec1);
???????????????????????Χ????????????????vector??????????????????????β????
??????10??[]??at()????????
????// ???vector?е?????
????vec1[2] = 99;
????PrintVector(vec1);
????vec1.at(3) = 88;
????PrintVector(vec1);
??????11??erase()???????????
????// ??????????????
????// ???????iterator?????ж?λ???????????????????????????????????????????????????????????????????
????vector<int>::iterator vItera = vec1.begin();
????vItera = vItera + 2;
????vec1.erase(vItera);
????PrintVector(vec1);
???????????????????????????
??????12??insert(): ???????
????// vector?????????????iterator????λ???λ??
????vector<int>::iterator vInsert = vec1.begin();
????vInsert = vInsert + 2;
????vec1.insert(vInsert?? 777);
????PrintVector(vec1);
????????????????????
??????13??clear():??????????
????// ???????????
????vec1.clear();
????PrintVector(vec1);
????cout << "vector???????" << vec1.empty() << endl;
??????????????????vector?????????κ?????