下面为测试代码:

1.创建

std::vector< std::vector<string> > vc2;

2.初始化 

    std::vector<string> vc; 
    vc.push_back("v11"); 
    vc.push_back("v12"); 
    vc.push_back("v13");

    std::vector<string> v2; 
    v2.push_back("v21"); 
    v2.push_back("v22"); 
    v2.push_back("v23");

    std::vector<string> v3; 
    v3.push_back("v21"); 
    v3.push_back("v22"); 
    v3.push_back("v23");

    vc2.push_back(vc); 
    vc2.push_back(v2); 
    vc2.push_back(v3);

3.执行删除操作

    for (std::vector<std::vector<string> >::iterator i = vc2.begin(); i != vc2.end();) { 
        for (std::vector<string>::iterator j = i->begin(); j != i->end(); ) { 
            j = i->erase(j); 
        } 
        i = vc2.erase(i); 
    }

 

相关文章:

  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-03-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2021-07-07
  • 2021-08-02
相关资源
相似解决方案