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 ...
随机推荐
- Maven 教程(19)— Maven的六类属性
原文地址:https://blog.csdn.net/liupeifeng3514/article/details/79776666 内置属性 主要有两个常用内置属性:${basedir}项目的根目录 ...
- php filter_var()
定义和用法 filter_var() 函数通过指定的过滤器过滤变量. 如果成功,则返回已过滤的数据,如果失败,则返回 false. 语法 filter_var(variable, filter, op ...
- Java并发编程基础-Unsafe
前言:Unsafe是Java中一个底层类,包含了很多基础的操作,比如数组操作.对象操作.内存操作.CAS操作.线程(park)操作.栅栏(Fence)操作,JUC包.一些三方框架都使用Unsafe类来 ...
- 【webrtc】webrtc的rtp重传代码分析
pgm不太能用,没有想象中的可靠,重传机制貌似仍然使用组播重传,丢包率80%的网络感觉没啥改进,如果有所好转延迟估计也是个不小的问题. 后听说rtp也有nack机制,webrtc基于rtp实现了重传在 ...
- BussinessSkinForm 入门教程
BussinessSkinForm 入门教程 By 刘家君(qufo) 作者:刘家君 工作单位:福建省 泉州鹭燕医药有限公司 职务:网络管理员 网名:qufo Mail:qufo@tom.com,qu ...
- Linux中常用命令pipe
大多数linux命令处理数据后都会输出到标准输出,但是如果数据要经过系列列的步骤处理后,才是需要的数据个数,这种需求就需要管道来帮助完成. 管道命令使用"|"作为界定符,将界定符前 ...
- latex中添加C++代码
用到listings宏包,模板如下: \documentclass[UTF8]{ctexart} \usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,rig ...
- 示例:WPF开发的简单ObjectProperyForm用来绑定实体表单
原文:示例:WPF开发的简单ObjectProperyForm用来绑定实体表单 一.目的:自定义控件,用来直接绑定实体数据,简化开发周期 二.实现: 1.绑定实体对象 2.通过特性显示属性名称 3.通 ...
- C#采集UVC摄像头画面并支持旋转和分辨率切换
在项目中,我们会需要控制uvc摄像头,采集其实时画面,或者对其进行旋转.目前市面上大多数USB摄像头都支持UVC协议.那么如何采集呢?当然是采用SharpCamera!因为SharpCamera支持对 ...
- Springboot揭秘-快速构建微服务体系-王福强-2016年5月第一次印刷
JavaConfig项目: spring IOC有一个非常核心的概念——Bean.由Spring容器来负责对Bean的实例化,装配和管理.XML是用来描述Bean最为流行的配置方式.Spring可以从 ...