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 ...
随机推荐
- 前端与算法 leetcode 242. 有效的字母异位词
目录 # 前端与算法 leetcode 242. 有效的字母异位词 题目描述 概要 提示 解析 解法一:哈希表 解法二:数组判断字符出现次数 解法三:转换字符串 算法 传入测试用例的运行结果 执行结果 ...
- Java核心技术-读书笔记
基本语法 Java中的所有函数都属于某个类的方法 Java没有任何无符号的int.long.short 或 byte 类型 浮点数值不适用于无法接受舍入误差的金融计算中,比如2.0-1.1不会输出想要 ...
- Dart面向对象编程(一)
基本内容概述: 类与对象: 计算属性: void main(){ var rect = new Rectangle(); rect.width = 20; rect.height = 10; prin ...
- C# - Array.Sort()方法
Array类简介 Array类是C#中所有数组的基类.我们常用的[]声明数组即为Array类的语法,我们可通过Array类提供的各种方法对C#中数组进行操作.最典型的就是数组排序 Array.Sort ...
- ML学习笔记之LATEX数学公式基本语法
作者:@houkai本文为作者原创,转载请注明出处:https://www.cnblogs.com/houkai/p/3399646.html 0x00 概述 TEX 是Donald E. Knuth ...
- Linux学习笔记之CentOS 7系统使用firewalld管理防火墙端口
0x00 firewalld的基本使用 # 启动: systemctl start firewalld # 查看状态: systemctl status firewalld # 停止: systemc ...
- Linux学习笔记之rsync配置
0x00 rsync 简介 Rsync(remote synchronize)是一个远程数据同步工具,可通过LAN/WAN快速同步多台主机间的文件,也可以使用 Rsync 同步本地硬盘中的不同目录. ...
- 获取html 中的内容 将前台的数据获取到后台 用 jquery 生成一个 form表单 提交数据
使用js创建一个form表单 ,使用post上传到后台中 下面是代码.在获取html内容的时候使用了js节点来获取内容. parent:父节点.上一级的节点 siblings:兄弟节点.同一级别的节点 ...
- C#DataTable使用方法详解
在项目中常常常使用到DataTable,假设DataTable使用得当,不仅能使程序简洁有用,并且可以提高性能,达到事半功倍的效果,现对DataTable的使用技巧进行一下总结. 1.添加引用 1 2 ...
- 【转载】华为荣耀V9的手机录屏功能如何开启
手机录屏有时候对我们的帮助很大,例如可以录制相应的APP使用教程.微信小程序使用流量讲解视频等,针对于软件开发人员等来说,手机录屏功能针对功能演示视频非常的有帮助.在华为荣耀V9手机中,进行手机录屏有 ...