标题:关于 istream_iterator的错误
只看楼主
karlzhouzhi
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2005-12-25
 问题点数:0 回复次数:0 
关于 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

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

搜索更多相关主题的帖子: istream iterator 
2006-04-13 23:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-57386-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.075394 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved