原文链接: http://www.cnblogs.com/yeahgis/archive/2012/05/29/2523476.html
#include <vector>
#include <iostream>
using namespace std;
int
main(
int
argc,
char
** argv)
{
std::vector<
int
> vec;
for
(
int
i=0;i<100;i++)
{
vec.push_back(i);
}
printf
(
"10:%d
"
,vec[10]);
printf
(
"size:%d
"
,vec.size());
printf
(
"**********************************
"
);
std::vector<
int
>::iterator it = vec.begin()+10;
vec.erase(it);
printf
(
"10:%d
"
,vec[10]);
printf
(
"size:%d
"
,vec.size());
return
0;
}
//输出
//10:10
//size:100
//**********************************
//10:11
//size:99