请教这段代码为啥运行时报错
请问这段代码为啥运行时报错?
编译不出错,运行时出错
------解决方案--------------------
lst必须是升序排列好的
#include<iostream>
#include<list>
using namespace std;
int main()
{
int n[]={1,2,1,2,3,3};
list<int> lst(n,n+4),lst2(n+2,n+6);
lst.merge(lst2); //出错
for(list<int>::iterator it=lst.begin();it!=lst.end();++it)
cout<<*it<<" ";
cout<<endl;
system("pause");
return 0;
}
编译不出错,运行时出错
------解决方案--------------------
lst必须是升序排列好的