下面为测试代码:

1.创建

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

2.初始化

  1. std::vector<string> vc;
  2. vc.push_back("v11");
  3. vc.push_back("v12");
  4. vc.push_back("v13");
  5.  
  6. std::vector<string> v2;
  7. v2.push_back("v21");
  8. v2.push_back("v22");
  9. v2.push_back("v23");
  10.  
  11. std::vector<string> v3;
  12. v3.push_back("v21");
  13. v3.push_back("v22");
  14. v3.push_back("v23");
  15.  
  16. vc2.push_back(vc);
  17. vc2.push_back(v2);
  18. vc2.push_back(v3);

3.执行删除操作

  1. for (std::vector<std::vector<string> >::iterator i = vc2.begin(); i != vc2.end();) {
  2. for (std::vector<string>::iterator j = i->begin(); j != i->end(); ) {
  3. j = i->erase(j);
  4. }
  5. i = vc2.erase(i);
  6. }

单独删除std::vector <std::vector<string> > 的所有元素的更多相关文章

  1. C++ 实现vector<std:string> 版本

    #include <iostream> #include <vector> #include <memory> #include <thread> #i ...

  2. matlab转c++代码实现(主要包含C++ std::vector,std::pair学习,包含数组与常数相乘,数组相加减,将数组拉成一维向量,图片的读入等内容)

    MATLAB部分: xmap = repmat( linspace( -regionW/2, regionW/2, regionW), regionH, 1 );%linspace [x1,x2,N] ...

  3. std::vector<std::vector<> >

    上次看到这个有点晕了,其实这个vector保存的是std::vector<> #include <vector> #include <iostream> using ...

  4. C++ Arrays, std::array, std::vector 总结

    原文来自: https://shendrick.net/Coding%20Tips/2015/03/15/cpparrayvsvector.html @Seth Hendrick Original a ...

  5. 把vector中的string对象导入到字符指针数组中

    #include <iostream>#include <string>#include <vector>//#include <cctype>#inc ...

  6. 编写程序,从vector<char>初始化string

    #include<iostream> #include<string> #include<vector> using namespace std; int main ...

  7. 没有与这些操作数匹配的 "<<" 运算符 操作数类型为: std::ostream << std::string

    错误显示:没有与这些操作数匹配的 "<<" 运算符       操作数类型为:  std::ostream << std::string 错误改正:要在头文 ...

  8. LeetCode 26 Remove Duplicates from Sorted Array [Array/std::distance/std::unique] <c++>

    LeetCode 26 Remove Duplicates from Sorted Array [Array/std::distance/std::unique] <c++> 给出排序好的 ...

  9. std::binary_serach, std::upper_bound以及std::lower_bound

    c++二分查找的用法 主要是 std::binary_serach,  std::upper_bound以及std::lower_bound 的用法,示例如下: std::vector<int& ...

随机推荐

  1. 【USACO】【section1.1】Your Ride Is Here

    以前的账号忘记了,只能从头了. 入门题不解释,就是sumg和sumc初始值置1不能置0.开始享用一个循环计算出sumg和sumc,其实两个数组最大程度为6,节省不了什么时间. /*ID:Moment1 ...

  2. Java动手实验及课后程序

    课后作业 一.编写程序,消息框显示计算结果 设计思想:导入Scanner包,使用JOptionPane类来实现消息框的输入和结果的显示. 程序代码: package com; import java. ...

  3. mvp(2)一个简单示例,加深理解

    参考: http://www.cnblogs.com/liuling/p/mvp-pattern-android.html 架构图: 1.View层 public interface NewsView ...

  4. MS UI Automation Introduction

    MS UI Automation Introduction 2014-09-17 MS UI Automation是什么 UIA架构 UI自动化模型 UI自动化树概述 UI自动化控件模式概述 UI 自 ...

  5. git cheatsheet小抄本

    https://www.kernel.org/pub/software/scm/git/docs/git.html

  6. HDU 4023 (博弈 贪心 模拟) Game

    如果硬要说这算是博弈题目的话,那这个博弈是不公平博弈(partizan games),因为双方面对同一个局面做出来的决策是不一样的. 我们平时做的博弈都是公平博弈(impartial games),所 ...

  7. Odoo 的库存管理与OpenERP之前的版本有了很大的不同,解读Odoo新的WMS模块中的新特性

    原文来自:http://shine-it.net/index.php/topic,16409.0.html 库存移动(Stock Move)新玩法Odoo的库存移动不仅仅是存货在两个“存货地点”之间的 ...

  8. Eclipse使用代码清理功能(Clean Up)

    本文转载自http://www.ibm.com/developerworks/cn/opensource/os-eclipse-clean/ 但是为了适应自己使用,还是自己总结了一下. 一.概述 代码 ...

  9. BZOJ 1787 紧急集合

    LCA.注意细节. #include<iostream> #include<cstdio> #include<cstring> #include<algori ...

  10. LeetCode Reverse Nodes in k-Group 每k个节点为一组,反置链表

    题意:给一个单链表,每k个节点就将这k个节点反置,若节点数不是k的倍数,则后面不够k个的这一小段链表不必反置. 思路:递归法.每次递归就将k个节点反置,将k个之后的链表头递归下去解决.利用原来的函数接 ...