#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <algorithm>
#include <list>
#include <set>
using namespace std;
int main()
{
vector<int> vec;
for (int i=0;i<10;i++)
{
vec.push_back(i);
}
// sort(vec.begin(),vec.end());
// copy(vec.begin(),vec.end(),ostream_iterator<int>(cout," "));
list<int> L,L1;
L.push_front(3);
front_insert_iterator<list<int> > ii(L);
*ii++=0;
*ii++=1;
*ii++=2;
copy(L.begin(),L.end(),ostream_iterator<int>(cout," "));
cout<<endl;
copy(vec.begin(),vec.end(),front_inserter(L1)); //L1以反向容纳Vec的内容
copy(L1.begin(),L1.end(),ostream_iterator<int>(cout," "));
/*****************合并**********************************************/
const int N=6;
int A1[N]={1,3,5,7,9,11};
int A2[N]={1,2,3,4,5,6};
set<int> result;
merge(A1,A1+N,A2,A2+N,inserter(result,result.begin()));
copy(result.begin(),result.end(),ostream_iterator<int>(cout," "));
cout<<endl;
/**************************reverse_copy*********************************************/
vector<int> v1(10);
for(i=0;i<10;i++)
{
v1[i]=i;
}
reverse_copy(v1.begin(),v1.end(),ostream_iterator<int>(cout," "));
cout<<endl;
vector<int>::reverse_iterator vv=v1.rbegin();
// copy(vv->begin(),vv->end(),ostream_iterator<int>(cout," "));
//copy(vv.,vv.end(),ostream_iterator<int>(cout," "));
return 0;
}