zoukankan      html  css  js  c++  java
  • c++ 指定长度容器元素的拷贝(copy_n)

    #include <iostream>     // cout

    #include <algorithm>    // copy

    #include <vector>       // vector

    using namespace std;

    int main () {

        int myints[]={10,20,30,40,50,60,70};

        vector<int> myvector;

        

        myvector.resize(2);   // allocate space for 7 elements

        

        copy_n ( myints, 5, myvector.begin() );

        

        cout << "myvector contains:";

        for (vector<int>::iterator it = myvector.begin(); it!=myvector.end(); ++it)

            cout << ' ' << *it;

        

        cout << ' ';

        

        return 0;

    }

  • 相关阅读:
    软件包的作用
    Sqlserver2008 表分区教程
    C#通用类型转换 Convert.ChangeType
    缓存 HttpContext.Current.Cache和HttpRuntime.Cache的区别
    用户信息 Froms验证票证
    .NET4.0 __doPostBack未定义
    TFS2012 安装 配置笔记
    MVC学习笔记一
    新博客..第一天..
    ORACLE多表查询优化
  • 原文地址:https://www.cnblogs.com/sea-stream/p/9816167.html
Copyright © 2011-2022 走看看