Boost logo

Boost :

Subject: Re: [boost] [string] Realistic API proposal
From: Patrick Horgan (phorgan1_at_[hidden])
Date: 2011-01-30 02:20:07

On 01/29/2011 10:56 AM, Mathias Gaunard wrote:
> On 29/01/2011 05:12, Joe Mucchiello wrote:
>> ... elision by patrick ...
>> This, and many of these functions, work much better as standalone
>> functions:
>> // with a string-aware function
>> if (!is_valid_utf8(my_string.begin(),my_string.end())) ....
> or if(!is_valid_utf8(my_string))

I still like the idea of a utf-8_string that enforces correct encoding,
i.e. it won't let you make a change to the string that would make the
above external function is_valid_utf8 return false. Then of course you
wouldn't need that function.

And please don't object by saying it would be better to have a different
type of string without the internal checks. I get what you're saying.
I want both at different times. But I do want this. Always knowing
that the string represented valid utf-8 would remove the burden of
checking that everywhere that wanted a valid utf-8 encoded string.


Boost list run by bdawes at, gregod at, cpdaniel at, john at