????????????????????
????1????????????????????????????????????????????????μ??????????λ???? iter ?????????????????????? n ??????λ?á?
????????????????????? iter ??? vector ?е?????????????? vector ????????????????????????????????? vector ?? size_type ?? difference_type ???????????
int main()
{
std::vector<int> ivec(10?? 68);
print_int_vector(ivec);
int i = 0;
for (std::vector<int>::iterator iter = ivec.begin(); iter != ivec.end(); ++iter?? i++)
*iter = i; // set element to which iter refers to i
print_int_vector(ivec);
std::vector<int>::iterator iter = ivec.begin();
iter += 100;
std::cout<<*iter;
return 0;
}
????????????ivec??10??????iter+=j??j??10??????????д??0~9???????????10?????????????????????????м??????????????????????
????2??iter1 - iter2??
????????????????????????????????????t???????? difference_type ?? signed ???? size_type ?????????? difference_type ?? signed ??????????????????????????????????????????????????洢?????????????????????????
????iter1 ?? iter2 ???????????? vector ?е???????????? vector ????????????????
????3???????????????????????????????????????????????硣???????????λ?? vector ?м?????
????vector<int>::iterator mid = vi.begin() + vi.size() / 2;
????????????????????? mid ?????? vi ?п??????м??????
????????????????????????????????????????????????????????м????????????????????Ч???????
????4??????????? vector ?????????????????????????Ч??
???????硣????? push_back ???????????????? vector ?????????????
????????????
????*iter = i; // set element to which iter refers to i
????ivec.push_back(i*2);
????????????????????????У???????????????for?????????У?????
????{
????*iter = i; // set element to which iter refers to i
????ivec.push_back(i*2);
????}
???????ī???????????
??????????@The_Third_Wave??Blog?????http://blog.csdn.net/zhanh1218???????
??????????в?????????н???????????????????????????????д??????????
????????????????????????????????????????????????????????????????Blog??