#include<iostream>
#include<iterator>
#include<vector>
using namespace std;
void main()
{
    int a[10]={6,7,2,9,4,11,8,7,10,5};
    vector<int>b(10);

    copy(a,a+10,b.begin());
    cout<<"let the b be a!\n";
    ostream_iterator<int,char>out(cout," ");
    copy(b.begin(),b.end(),out);
    cout<<endl;

    cout<<"implicit use of reverse iterator,\n";
    copy(b.rbegin(),b.rend(),out);
    cout<<endl;

    cout<<"explicit yse of reverse iterator,\n";


    vector<int>::reverse_iterator ri;
    for(ri=b.rbegin();ri!=b.rend();++ri)
        cout<<*ri<<' ';
    cout<<endl;





}

posted on 2013-02-23 14:59  叶城宇  阅读(127)  评论(0编辑  收藏  举报