#include<iostream>
#include<iterator>
#include<algorithm>
#include<iterator>
#include<vector>
using namespace std
;
template<class T,class InputIterator, class OutputIterator>
OutputIterator
mycopy(InputIterator first
, InputIterator last
, OutputIterator result
)
{
vector
<T
>s
;
vector
<T
>::iterator it1
;
for (; first
!= last
; first
++)
s
.push_back(*first
);
for (it1
= s
.begin(); it1
!= s
.end(); it1
++)
{
*result
= *it1
;
result
++;
}
return result
;
}
int main() {
int a
[] = { 1,2,3,4,5 };
mycopy
<int>(a
, a
+ 5, ostream_iterator
<int>(cout
, " "));
system("pause");
return 0;
}
转载请注明原文地址: https://mac.8miu.com/read-52433.html