Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2004-10-22 09:47:20


Rogier van Dalen wrote:
> On Thu, 21 Oct 2004 16:02:34 -0700, Eric Niebler
> <eric_at_[hidden]> wrote:
>
>>No fair bringing religion into this. ;-) I'll repeat what I said before
>>-- this would be an unfortunate design, and you'll hear about it from
>>your users. If you force people to do their bit twiddling in
>>vector<char*_t>, then you impose an extra allocation and a copy to get
>>it into a unicode::string, and most people won't bother.
>
>
> What frequent use cases do you see where people will want to change
> bits rather than work with characters?
>

utf8_string str;
str.reserve(some_big_number);

ifstream file("utf8.txt");
istreambuf_iterator<char8_t> begin(file), end;

std::copy( begin, end, back_inserter(str) );

This can't throw if you want people to use your string class.

-- 
Eric Niebler
Boost Consulting
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