
On Fri, 22 Oct 2004 18:09:12 +0300, Peter Dimov <pdimov@mmltd.net> wrote:
Eric Niebler wrote:
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.
utf8_string str( begin, end );
Seems sensible, though I would like to reintroduce the as_utf8_tag class I introduced earlier. I think the utf8_string we're talking about is either a sequence of char32_t's, or a sequence of unicode::character's (encoded differently underlyingly). Whatever it is, I think you'll want to make a difference between a UTF-8 code unit iterator, a UTF-16 code unit iterator and a UTF-32 one, and make it: utf8_string str (begin, end, as_utf8_tag()); Rogier