Boost logo

Boost Users :

Subject: Re: [Boost-users] [range] istream_range from a temporary istream
From: Nathan Ridge (zeratul976_at_[hidden])
Date: 2011-07-22 05:31:23


> This way one can write things like:
>
> vector<T> v;
> push_back(v, istream_range<T>(ifstream("some_file.txt")));

Of course, one must be careful with such things.
 
Can you spot the bug in the following?
 
BOOST_FOREACH(const string& s, istream_range<string>(ifstream("some_file.txt")))
    cout << s;
 
Regards,
Nate


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net