stl中set迭代器的问题,编译无法通过,求大神给个方案,代码已经贴出了
程序代码:
using namespace std; #include <set> #include <iostream> #include <ctime> #include <iterator> int main() { typedef set<int> n_set; typedef ostream_iterator< n_set > ostream_itr; n_set n_set_test; srand(time(0)); for(int i=0;i<10;i++) { int temp=rand()%1000; n_set_test.insert(temp); cout<<temp<<"\n"; } copy(n_set_test.begin(),n_set_test.end(),ostream_itr(cout,"\n")); return 0; }
编译无法通过,copy这一行报错.