//元素删除 尾部删除用pop_back();头部删除用pop_front();
//任意迭代位置或迭代区间上的元素删除用erase(&pos)/erase(&first, &last);删除所有元素用clear();
cout<<"d1.pop_front(): "<<endl;
d1.pop_front();
printDeque(d1);
cout<<"d1.erase(d1.begin()+1): "<<endl;
d1.erase(d1.begin()+1); //删除第2个元素d1[1]
printDeque(d1);
cout<<"d1.erase(d1.begin(), d1.begin() + 2) = "<<endl;
d1.erase(d1.begin(), d1.begin() + 2);
printDeque(d1);
cout<<"d1.clear() :"<<endl;
d1.clear();
printDeque(d1);
//其它常用
cout<<"其它常用用法: "<<endl;
int flag = 0;
while(flag < 2)
}
转帖自:http://www.cppblog.com/huyutian/articles/107459.html