Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-10-22 11:23:20


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk