VC6.0支持C++不足处之一

来源:互联网 发布:淘宝网 服务中心 编辑:程序博客网 时间:2024/05/18 20:13
上代码:
#include <iostream>
#include <iterator>
#include <algorithm>
#include <string>
#include <vector>
#include <fstream>

using namespace std;

int main( void )
{
    stringfrom,to;
    cin>> from ;
    cin>> to;

    ifstream is(from.c_str() );
   istream_iterator ii(is);
   istream_iterator eos;

    vector b(ii,eos); //此处vc6.0编译器提示一个错,见下面备注处。
   sort(b.begin(),b.end());

    ofstreamos(to.c_str());
   ostream_iterator oo(os,"\n");

   unique_copy(b.begin(),b.end(),oo);
   
    return(!is.eof() || !os);
}

备注:编译错误提示信息
--------------------Configuration: IOiterator - Win32Debug--------------------
Compiling...
IOiterator.cpp
G:\VC6.0 TestCode_C\IOiterator.cpp(20) : error C2664: '__thiscallstd::vector,class std::allocator >,classstd::allocator,cla
ss std::allocator > >>::std::vector,class std::allocator>,class std::allocator,class std::allocator> > >(unsig
ned int,const class std::basic_string,class std::allocator> &,const class std::allocator,classstd::allocator > >&)' : cannot convert paramet
er 1 from 'class std::istream_iterator,class std::allocator>,char,struct std::char_traits >' to'unsigned int'
       No user-defined-conversion operator available that can perform thisconversion, or the operator cannot be called
执行 cl.exe 时出错.

IOiterator.obj - 1 error(s), 0 warning(s)
---------------------------------------------------------------------------错误提示完毕--
--------------------------------------------------------------------------------------------
在vs2008版本以上运行正常。
原创粉丝点击