新微赢技术网

标题: 关于 istream_iterator的错误 [打印本页]

作者: 街头霸王爷    时间: 2009-11-3 00:53
标题: 关于 istream_iterator的错误
f()
{
typedef set<string>::difference_type diff_type;
.........
istream_iterator<string,diff_type> input_set(infile),eos; //这里出现了编译错误
copy(input_set,eos,inserter(exclusion_set,exclusion_set.begin()));
........
}
错误信息:
D:\programe\C++ primer\test2\main.cpp(229) : error C2664: '__thiscall std::istream_iterator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,struct std::char_traits<int> >::std::istream_iterator<class std::
basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,struct std::char_traits<int> >(class std::basic_istream<int,struct std::char_traits<int> > &)' : cannot convert parameter 1 from 'class std::basic_ifstream<char,struct
std::char_traits<char> >' to 'class std::basic_istream<int,struct std::char_traits<int> > &'
A reference that is not to 'const' cannot be bound to a non-lvalue

怎么解决这个错误,谢谢:)




欢迎光临 新微赢技术网 (http://bbs.weiying.cn/) Powered by Discuz! X3.2