下面为测试代码:

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. Java:IO流与IO设备

    打印流:PrintWriter和PrintStream 特点:可以直接操作输入流和文件 //例子1:使用PrintStream将格式化的日期打印到文件中 import java.io.*; impor ...

  2. Netty4.x中文教程系列(二) Hello World !

    在中国程序界.我们都是学着Hello World !慢慢成长起来的.逐渐从一无所知到熟悉精通的. 第二章就从Hello World 开始讲述Netty的中文教程. 首先创建一个Java项目.引入一个N ...

  3. Crypto API加密通信流程

    应用程序使用Crypto API进行加密通信的一般步骤如下: 1,include wincrypt.h 2,调用CryptAcquireContext()获得某个CSP模块中的密钥容器(key con ...

  4. git忽略文件【转】

    转自: http://cwind.iteye.com/blog/1666646 有很多文件不必使用git管理.例如Eclipse或其他IDE生成的项目文件,编译生成的各种目标或临时文件等.使用git ...

  5. INDIGO STUDIO神器!快速创建WEB、移动应用的交互原型工具【转】

    转自:http://www.uisdc.com/indigo-studio-wireframe-interactive-uis 这套最新的设计工具出自Indigo工作室,永久免费,有mac版本和WIN ...

  6. Android 判断用户2G/3G/4G移动数据网络

    Android 判断用户2G/3G/4G移动数据网络 在做 Android App 的时候,为了给用户省流量,为了不激起用户的愤怒,为了更好的用户体验,是需要根据用户当前网络情况来做一些调整的,也可以 ...

  7. 查看linux系统常用的命令,Linux查看系统配置常用命令

    一.linux CPU大小  cat /proc/cpuinfo |grep "model name" && cat /proc/cpuinfo |grep &qu ...

  8. SQLServer2008 行转列2

    with a as ( select numb,name,row_number() over( partition by numb order by name desc) rowid from fen ...

  9. java socket编程基础

    1. [代码]读操作Runable 1 package com.hrd.test.socket; import java.io.BufferedReader; import java.io.IOExc ...

  10. combobox远程加载数据的总结和Json数据的小结

    1.从后台返回请求加载Combobox下拉框数据 html部分1 <select name="mateBelongZ" id="mateBelongZID" ...