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;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at