#include
#include
using namespace std;
int main( )
{
vector v; // create zero-length vector
int i;
// put values into a vector
for(i=0; i<10; i++) v.push_back('A' + i);
// can access vector contents using subscripting
for(i=0; i<10; i++) cout << v[i] << " ";
cout << endl;
// access via iterator
vector::iterator p = v.begin( );
while(p != v.end()) {
cout << *p << " ";
p++;
}
return 0;
}
//遍历比较删除,
vector<RFMSStepFlowButton*>::iterator it1 = m_unionlist.begin();
int i =0;
for(;it1 != m_unionlist.end();i++)
{
if (...)
{
//如果符合条件,就删除3个。
it1 = m_unionlist.erase(it1-i%3,it1-i%3+3);
i+=3;
}
else if (...)
{
//如果符合条件,就删除1个。
it1 = m_unionlist.erase(it1);
i++;
}
else
{
it1++;
}
}