单独删除std::vector <std::vector<string> > 的所有元素
下面为测试代码:
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> > 的所有元素的更多相关文章
- C++ 实现vector<std:string> 版本
		#include <iostream> #include <vector> #include <memory> #include <thread> #i ... 
- matlab转c++代码实现(主要包含C++ std::vector,std::pair学习,包含数组与常数相乘,数组相加减,将数组拉成一维向量,图片的读入等内容)
		MATLAB部分: xmap = repmat( linspace( -regionW/2, regionW/2, regionW), regionH, 1 );%linspace [x1,x2,N] ... 
- std::vector<std::vector<> >
		上次看到这个有点晕了,其实这个vector保存的是std::vector<> #include <vector> #include <iostream> using ... 
- C++ Arrays, std::array, std::vector 总结
		原文来自: https://shendrick.net/Coding%20Tips/2015/03/15/cpparrayvsvector.html @Seth Hendrick Original a ... 
- 把vector中的string对象导入到字符指针数组中
		#include <iostream>#include <string>#include <vector>//#include <cctype>#inc ... 
- 编写程序,从vector<char>初始化string
		#include<iostream> #include<string> #include<vector> using namespace std; int main ... 
- 没有与这些操作数匹配的 "<<" 运算符       操作数类型为:  std::ostream << std::string
		错误显示:没有与这些操作数匹配的 "<<" 运算符 操作数类型为: std::ostream << std::string 错误改正:要在头文 ... 
- 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++> 给出排序好的 ... 
- std::binary_serach,  std::upper_bound以及std::lower_bound
		c++二分查找的用法 主要是 std::binary_serach, std::upper_bound以及std::lower_bound 的用法,示例如下: std::vector<int& ... 
随机推荐
- TCP三次握手和四次挥手过程及套接字在各个过程中的状态解析
			说起TCP,我们一般都需要知道发起一个tcp连接和终止一个tcp连接是所发生的事情,下边,我将跟大家介绍下tcp的三次握手及四次挥手的过程. TCP三路握手 (1)服务器必须准备好接受外来的连接.这通 ... 
- webapp 开发之iScroll 学习
			demo.html <!doctype html> <html lang="en"> <head> <meta charset=" ... 
- Data Base  sqlServer   sa用户登陆失败的解决办法
			sqlserver sa用户登陆失败的解决办法 如下图以此模仿: 1.右键-属性 2.找到安全: 3.勾选如图: 4.sa用户密码重置: 5.服务重启: 
- Debugging JTAG Connectivity Problems
			2013-12-04 22:34:26 转自:http://processors.wiki.ti.com/index.php/Debugging_JTAG_Connectivity_Problems ... 
- vim 添加到右键  windows
			>>>> 在windows下 <<<< ++ 在鼠标右键显示“用vim编辑”++ 1.删掉注册表中的HKEY_CLASSES_ROOT\*\shelle ... 
- 对Java不能多继承,只能单继承,却可以实现多个接口的理解
			1.java与C++的不同点在于多继承. Java:不能多继承,只能单继承,但可以实现多个接口 C++:可以实现多继承.例如: class A extends B implements C,D,E { ... 
- BZOJ 3224 普通平衡树(树状数组)
			题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=3224 题意:维护以下操作:(1)插入x:(2)删除x(若有多个相同的数,只删除一个)(3 ... 
- 编译Apache Hadoop2.2.0源代码
			Hadoop2的学习资料很少,只有官网的少数文档.如果想更深入的研究hadoop2,除了仅看官网的文档外,还要学习如何看源码,通过不断的调试跟踪源码,学习hadoop的运行机制. 1.安装CentOS ... 
- 1427. SMS(DP)
			1427 题意不太好理解 其它没什么 细心啊 细心 一个0写成了1 WA半天 以每个字符是以第一种方式还是第二种方式来D #include <iostream> #include<c ... 
- Asp.Net生命周期系列三
			上文讲到了HttpRunTime主要做了三个事情,我们先回忆一下. 第一:雇佣了项目经理(HttpApplication). 第二:建立了HttpModule列表,项目经理(HttpRunTime)就 ... 
