Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why does istream_iterator not work with microsoft c++

Status
Not open for further replies.

isthisreallyit

Programmer
Jan 2, 2003
6
GB
Hi,

All the examples I am trying, using, istream_iterator, do not work.

I get crappy error messages, like ....


error C2440: 'type cast' : cannot convert from 'istream_withassign' to 'std::istream_iterator<_Ty,_Elem,_Traits,_Diff>'
with
[
_Ty=int,
_Elem=char,
_Traits=std::char_traits<char>,
_Diff=ptrdiff_t
]


All I am doing, is using a simple example ...


vector<int> V;
std::copy(istream_iterator<int>(cin),
istream_iterator<int>(),
back_inserter(V));

2 lines, and it still screws-up??? I'm using Visual Studio.NET.


Any suggestions please

 
To clarify, use <iostream> (without the &quot;.h&quot;) instead. You can probably pick that up from your std::string thread, but I mention it for the benefit of anyone else who might read this.
 
yeah as they said use:
#include <iostream>

instead of:
#include <iostream.h>

With Microsoft Programs it seems to like it without the .h
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top