迭代器问题
#include<algorithm>#include<iostream>
#include<iterator>
template<typename Iter>
void print(Iter first,Iter last,const char* nm="", const char* seq="\n",std::ostream& os=std::cout){
if(nm!=0&&nm!='\0')
os<<nm<<":"<<seq;
typedef typename iterator_traits<Iter>::value_type T;
copy(first,last,ostream_iterator<T>(cout,seq));
os<<std::endl;
}
--------------------配置: mingw5 - LIB Release, 编译器类型: MinGW--------------------
检查文件依赖性...
正在编译 C:\Users\zjy\Documents\C-Free\Temp\未命名15.cpp...
[Error] C:\Users\zjy\Documents\C-Free\Temp\未命名15.cpp:9: error: expected nested-name-specifier before "iterator_traits"
[Error] C:\Users\zjy\Documents\C-Free\Temp\未命名15.cpp:9: error: expected initializer before '<' token
[Error] C:\Users\zjy\Documents\C-Free\Temp\未命名15.cpp:10: error: `ostream_iterator' was not declared in this scope
[Error] C:\Users\zjy\Documents\C-Free\Temp\未命名15.cpp:10: error: `T' was not declared in this scope
[Error] C:\Users\zjy\Documents\C-Free\Temp\未命名15.cpp:10: error: `cout' was not declared in this scope
构建中止 未命名15: 5 个错误
求帮助...