C++ problem

Mikael Hansson EMAIL HIDDEN
Fri May 29 00:26:43 CEST 2009


I'm having trouble getting this to work, I'm getting a runtime error

 ifstream is("fil.dat");
 istream_iterator<ShapePtr> shapein(is), endofshapein;
 list<ShapePtr> shapelist(shapein, endofshapein );


Strangely this version works:

 ifstream is("fil.dat");
 istream_iterator<ShapePtr> shapein(is), endofshapein;
 list<ShapePtr> shapelist;
 for (; shapein != endofshapein; shapein++)
      shapelist.push_back(*shapein);

which in my head should be about the same??

What am I missing?

/Micke



More information about the music-bar mailing list