vector Construct
#include<vector>
#include<iostream>
using namespace std;
void Test(); void main()
{
int a[]={,,,,};
vector<int> v_a(a,a+);
vector<int> v_b(v_a.begin(),v_a.end()); vector<int>::iterator it;
for (it=v_a.begin();it!=v_a.end();++it)
{
cout<<*it<<" ";
}
cout<<endl; ///////////////////////
for (it=v_b.begin();it!=v_b.end();++it)
{
cout<<*it<<" ";
}
cout<<endl; ///////////////////////
Test();
} void Test()
{
int a[]={,,,,};
vector<int> v_a(a,a+);
vector<int> v_b(v_a.begin(),v_a.end()); vector<int>::iterator it;
for (it=v_a.begin();it!=v_a.end();++it)
{
cout<<*it<<" ";
}
cout<<endl; ///////////////////////
for (it=v_b.begin();it!=v_b.end();++it)
{
cout<<*it<<" ";
}
cout<<endl; /////////////////////// } // 1 2 3 4 5
// 1 2 3 4 5
// 1 2 3 4
// 1 2 3 4
// Press any key to continue
vector Construct的更多相关文章
- OpenFOAM 中 c++ 基础
文件布置 在 OpenFOAM 中,所有代码都以注释段开头,使用有限体积的 CFD 类型文件都包括以下头文件 #include "fvCFD.H" 在此头文件种,仅包含类或函数的定 ...
- [LeetCode] Construct Binary Tree from Inorder and Postorder Traversal 由中序和后序遍历建立二叉树
Given inorder and postorder traversal of a tree, construct the binary tree. Note: You may assume tha ...
- [LeetCode] Construct Binary Tree from Preorder and Inorder Traversal 由先序和中序遍历建立二叉树
Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that ...
- 模板化的七种排序算法,适用于T* vector<T>以及list<T>
最近在写一些数据结构以及算法相关的代码,比如常用排序算法以及具有启发能力的智能算法.为了能够让写下的代码下次还能够被复用,直接将代码编写成类模板成员函数的方式,之所以没有将这种方式改成更方便的函数模板 ...
- Leetcode Construct Binary Tree from Inorder and Postorder Traversal
Given inorder and postorder traversal of a tree, construct the binary tree. Note:You may assume that ...
- [c++] vector的使用
} { vec.push_back(value); } { vector< vector<,); vector<, sec ...
- 源码阅读笔记 - 2 std::vector (1)
vector的源码真是太长了,今天用了一个下午和一个晚上看和注释了前面的一千行左右 p.s.博客园的代码高亮真是太垃圾, 如果想要阅读带注释的源码,推荐粘贴到VS2015里,然后按ctrl+z取消自动 ...
- Construct Binary Tree from Inorder and Postorder Traversal
Construct Binary Tree from Inorder and Postorder Traversal Given inorder and postorder traversal of ...
- Construct Binary Tree from Preorder and Inorder Traversal
Construct Binary Tree from Preorder and Inorder Traversal Given preorder and inorder traversal of a ...
随机推荐
- Spring+Spring+Hibernate环境搭建
源码地址:https://gitee.com/kszsa/ssht.git 一.引入lib包 pom.xml,引入需要的jar包 <?xml version="1.0" en ...
- mysql 添加注释
给表添加注释: alter table m_tb100_disabledsoldier comment '残疾士兵'; 给表中的字段添加注释alter table m_tb100_disable ...
- SQLite中字段顺序和PAGE_SIZE对性能的影响
1.背景 SQLite数据库中有1张表,该表含若干个字段,其中有1个字段为BLOB类型,且BLOB字段不是最后1个字段.表结构类似如下(col3为BLOB字段): T (col1 INTEGER,co ...
- html5点击input没有出现光标完美解决方案
html5点击input没有出现光标完美解决方案 <pre> <input type="text" placeholder="输入姓名" cl ...
- JavaScript核心知识点
一.JavaScript 简介 一.JavaScript语言的介绍:JavaScript是基于对象和原型的一种动态.弱类型的脚本语言 二.JavaScript语言的组成:JavaScript是由核心语 ...
- [转帖]Java Netty简介
Java Netty简介 https://www.cnblogs.com/ghj1976/p/3779820.html Posted on 2014-06-10 13:41 蝈蝈俊 阅读(2992) ...
- Effective.Java第34-44条(枚举)
34. 使用枚举类型替代整型常量 常量的语义表达不清晰,只能靠前面的名称来区分.枚举具有可读性.更安全.更强大等优势.而且枚举类型对象之间的值比较可以使用==来比较值是否相等的,不是必须使用equa ...
- C语言输入单字符避免回车的四种方法
在scanf()中使用'\n'屏蔽回车符号. scanf("%d\n", &n); scanf("%c", &c); 2.在scanf()格式串 ...
- 搭建zipkin并以mysql的方式存储数据
zipkin以mysql的方式存储 (centos+java8+mysql+zipkin2.3.1) 前言: 这篇教程用于搭建已mysql作为存储的zipkin.(还不知道zipkin是什么的小伙伴请 ...
- Docker 安装 Redis, 搭建 Redis 环境
欢迎关注个人微信公众号: 小哈学Java, 文末分享阿里 P8 资深架构师吐血总结的 <Java 核心知识整理&面试.pdf>资源链接!! 个人网站: https://www.ex ...