// constructing vectors
#include <iostream>
#include <vector> int main ()
{
// constructors used in the same order as described above:
std::vector<int> first; // empty vector of ints
std::vector<int> second (4, 100); // four ints with value 100
std::vector<int> third (second.begin(), second.end()); // iterating through second
std::vector<int> fourth (third); // a copy of third std::cout << "The contents of second are:";
for (std::vector<int>::iterator it = second.begin(); it != second.end(); ++it)
{
std::cout << ' ' << *it;
}
std::cout << '\n'; // the iterator constructor can also be used to construct from arrays:
int myints[] = {16, 2, 77, 29};
std::vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) ); std::cout << "The contents of fifth are:";
for (std::vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it)
{
std::cout << ' ' << *it;
}
std::cout << '\n'; return 0;
}

  

最新文章

  1. C# 使用IComparer自定义List类的排序方案
  2. Ubuntu 16.04中安装Chromium浏览器
  3. 注解@PostConstruct与@PreDestroy讲解及实例
  4. Spring 通过FactoryBean配置Bean
  5. Unhandled Error in Silverlight Application “Syncfusion.Silverlight.Olap.Gauge.OlapGauge”的类型初始值设定项引发异常
  6. [iOS基础控件 - 7.0] UIWebView
  7. 在Tomcat中配置基于springside的项目
  8. asp.net将数据库中的数据赋给DropDownList
  9. DC综合环境的一些概念
  10. linux动态库加载的秘密
  11. To the Max(矩阵压缩)
  12. Spring Data Rest 支持Put请求
  13. SQL数据库文件修复/用友/金蝶/管家婆/速达/思讯数据库恢复 硬盘恢复
  14. 解决xcode10打包报错:That command depends on command in Target ‘xxx’:scrpit phase&quot;[CP] Copy Pods Resources&quot;
  15. How to install Hadoop Cluster
  16. lvm讲解/磁盘故障小案例
  17. IPC通信:Posix消息队列
  18. java &amp; maven pom
  19. day01作业
  20. Objective-C-类(static)方法、实例方法、overwrite(覆写)、属性(property)复习

热门文章

  1. Thinkphp 使用小结
  2. 【LOJ】#3042. 「ZJOI2019」麻将
  3. BOF和EOF的详细解释 ADO的三个核心对象
  4. PAT A1006 Sign In and Sign Out (25)
  5. MySQL各大存储引擎
  6. 位运算解决“一个数组中,只有一个数字出现n次,其他数字出现k次”问题
  7. aspose导出数据
  8. python之输入一系列整数输出最大值
  9. Laravel使用whereHas进行过滤不符合条件的预加载with数据
  10. java后台读取配置文件