C++?????vector?????????
???????????? ???????[ 2014/7/11 11:30:38 ] ????????C++ net
??????C++???飬??????????μ????????vector???????????????
????vector????????????????????????????????????????????string???????????????????????洢?????????檔????????
????#include<vector>
????1.vector?????????????
????1 vector<T> v1 vector?????????T???????????????v1???
????2 vector<T> v2(v1) v2??v1?????????
????3 vector<T> v3(n??i) v3????n????i?????
????4 vector<T> v4(n) v4????????????????n??????
?????????????????????????????????????????????????????????????????????????????????????????е????????????????Σ??????洢??vector???????????????
???????vector??????????????int????????????0?????????????
????vector<int> vv(10); //10?????????????????0
???????vector?????????й?????????????????????????????????????????????????????
????vector<string> vvvv(10) //10????????????????????????
???????е????????????????????????ж??幹?????????????????????£?????????????????????????????????????????????????????
????2.vector????????
????????????????
1 v.empty() ???v????????true????????false
2 v.size() ????v?????????
3 v.push_back() ??v???β?????????t?????
4 v[n] ????v??λ???n?????
5 v1=v2 ??v1?е?????滻?v2?????????
6 v1==v2 ???v1??v2????????true
7 !=??<??<=??>??>= ??????Щ?????????к???
|
????size()???????vector?????size_type?????
????vector::size_type //error
????vector<int>::size_type //ok
????push_back()???????????????vector???檔
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11