#include
#include
#include
using namespace std;
int main()
{
listlst;
for(int i=1;i
lst.push_back(i);
listlst2;
copy(lst.begin(),lst.end(),inserter(lst2,lst2.begin()));
cout<<"lst2:begin(): ";
for(auto it=lst2.begin();it!=lst2.end();it++)
cout<<*it<<ends;
cout<<endl;
system("pause");
}
为何输出为1 2 3 4而不是4 3 2 1,不是说inserter插入器要把元素插在第二个参数指定的元素之前么?
本人理解一是第一次插入结果1,第二次应该为2,1...故有上述问题
二是inserter插入器调用了insert(p,b,e)版本,则无此问题
求大神解疑