STL algorithm之copy
来源:互联网 发布:千牛mac官方下载 编辑:程序博客网 时间:2024/05/16 07:01
定义:
template <class InputIterator, class OutputIterator> OutputIterator copy ( InputIterator first, InputIterator last, OutputIterator result );
作用:
将[first, last)范围的元素,拷贝到以result开始的范围内。类似于:
template<class InputIterator, class OutputIterator> OutputIterator copy ( InputIterator first, InputIterator last, OutputIterator result ){ while (first!=last) *result++ = *first++; return result;}
注意:
如果待拷贝的区间与原区间有重叠,则应该使用copy_backward。
返回:
返回指向目的区间的最后一个元素的迭代器
示例:
#include <iostream>#include <algorithm>#include <vector>using namespace std;int main () { int myints[]={10,20,30,40,50,60,70}; vector<int> myvector; vector<int>::iterator it; myvector.resize(7); copy ( myints, myints+7, myvector.begin() ); cout << "myvector contains:"; for (it=myvector.begin(); it!=myvector.end(); ++it) cout << " " << *it; cout << endl; return 0;}
- STL algorithm之copy
- STL algorithm算法copy(6)
- STL algorithm之binary_search
- STL之algorithm概述
- STL Algorithms 之 copy
- stl 之 copy copy_backward
- STL算法之copy
- STL之copy
- stl之算法copy
- STL之copy
- STL algorithm学习之adjacent_find()
- C++ STL算法之:copy
- STL之string,vector,algorithm常用方法
- ACM/ICPC竞赛之STL--algorithm
- STL algorithm 之 unique 函数的用法
- C++STL库之algorithm库
- ACM/ICPC竞赛之STL--algorithm
- C++STL之algorithm(一)
- ucos-ii的任务控制块
- Powerdesigner数据库开发指南
- Unity动画事件
- 如何利用JM8.6解码器提取码流中P帧宏块(所有4*4块)的运动矢量(考虑B帧,设x264编码的12帧为IDR BBPBBPBBPBP)
- 基础文章7:chap15 进程通信之管道 补充
- STL algorithm之copy
- RPG游戏中阻碍半透明遮挡(C# XNA)
- java7 NIO2(6) watching service API
- 开源 免费 java CMS - FreeCMS-标签 infoList
- 磁盘分区
- Android Bundle类
- Python类
- rman 迁移ASM到异机文件系统实战
- Apache configuration files on Ubuntu