下面为测试代码:

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);
}

单独删除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. 277. Find the Celebrity

    题目: Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exi ...

  2. Android从零单排之自动跟新

    自动更新原理 当我们发布我们的应用程序的时候,肯定会想到后续版本的更新,那么该怎么对我们的程序进行更新呢? 更新APK的原理实际上就是比较程序中的AndroidManifest.xml中的versio ...

  3. 求1+2+…+n,要求不能使用乘除法、for、while、if、else、s witch、case 等关键字以及条件判断语句(A?B:C)和不用循环/goto/递归输出1~100的10种写法

    来源:据说是某一年某个公司的面试题 题目:求1+2+…+n, 要求不能使用乘除法.for.while.if.else.s witch.case 等关键字以及条件判断语句(A?B:C) 分析:这题本来很 ...

  4. URAL 1233 Amusing Numbers 好题

    参照了nocow上的解法,照搬过来…… 易知一个数X在数列中在另一个数Y前,当且仅当X前缀小于Y或前缀相等X短,那么我们分布考虑,比如对于数48561: 5位上:10000~48560; 4位上:10 ...

  5. Weblogic控制器的部署

    WebLogic的安装 一 WebLogic安装 1.  打开WebLogic安装程序:oepe11_wls1031.exe(我们选用的是WebLogic 10.3g).如图1-1所示: 图1-1   ...

  6. 手机上的频段GSM GPRS分别是什么

    GSM是一种第二代无线通信的网络制式标准,GPRS是GSM应用的一种数据业务(如上网).频段:上行:890-915MHz(中国移动:890-909,中国联通:909-915)下行:935-960MHz ...

  7. C#中的文件同步

    How to: Synchronize Files by Using Managed Code FileSyncProvider Class File Synchronization Provider ...

  8. jpa+spring配置多数据源

    property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/test?useU ...

  9. ubuntu 安装 rabbitmq-server

    Rabbitmq 是用 erlang 语言写的,所以我们需要安装 Erlang,安装 erlang 又需要安装 python 与 simplejson,所以我们从python开始: 1.安装 pyth ...

  10. 为Gradle添加tomcat插件,调试WEB应用

    Gradle提供了不输于maven的依赖管理 提供了强大的test功能,输出优美的测试报告 并且提供war插件,使用内置的jetty调试WEB应用 因为博主偏偏钟情于tomcat,所以希望使用tomc ...