|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-10-22 12:12:53
"Peter Dimov" <pdimov_at_[hidden]> writes:
> David Abrahams wrote:
>> Is this going to be illegal for most fs, then?
>> std::copy(
>> std::istream_iterator<char>(f), std::istream_iterator<char>(),
>> std::back_inserter(my_utf8_string));
>> I think it pretty much has to work.
>
> my_utf8_string.append(
> std::istream_iterator<char>(f), std::istream_iterator<char>() );
>
> is the proper spelling. Or, if you prefer,
>
> my_utf8_string.insert( my_utf8_string.end(),
> std::istream_iterator<char>(f), std::istream_iterator<char>() );
>
> Character by character push_back loops just aren't cool.
Okay, but should we make this well-known and understood idiom one
that compiles and fails at runtime?
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk