|
Boost Users : |
Subject: Re: [Boost-users] [range] istream_range from a temporary istream
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2011-07-22 06:07:18
Den 22-07-2011 11:31, Nathan Ridge skrev:
>
>> 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;
>
Wouldn't that fail to compile if the istream_range is not copyable, but
movable?
-Thorsten
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