Boost logo

Boost :

Subject: Re: [boost] [string] Realistic API proposal
From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2011-01-28 07:01:34


On 28.01.2011 11:41, Artyom wrote:
> 2. It is fully compatible with std::string giving
> an ability to be included in C++XYZ
Actually, I think changing std::string from being "whatever the user put
into it" to "UTF-8, definitely" is not a compatible change. Worse, it's
a runtime-breaking change, not a compile-time breaking change.
Inspecting your proposed interface, I think you mean for std::string to
be any data, with the additional functionality only working if
is_valid_utf() is true. That sounds rather dangerous in usage, though,
since such a requirement is hard to remember. ("Now which member
functions can I call on all strings, and which only on valid UTF?")

> Advantages:
> -----------
>
> 3. It allows to use std::string meanwhile under the hood as storage
> giving high efficiency when assigning boost::string to std::string
> when the implementation is COW (almost all implementations with
> exception of MSVC)
I'm sorry, but COW is on its way out. Conforming C++0x strings are
forbidden to use it.

Sebastian


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