Boost logo

Boost :

Subject: Re: [boost] [General] Always treat std::strings as UTF-8
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2011-01-20 20:19:24


On Thu, 20 Jan 2011 15:46:01 -0800, Chad Nelson
<chad.thecomfychair_at_[hidden]> wrote:

> On Thu, 20 Jan 2011 12:52:25 -0800
> Mostafa <mostafa_working_away_at_[hidden]> wrote:
>
>>>> Can we stick to std::string conventions as closely as possible? It
>>>> makes using whatever new string library that much easier, and
>>>> clearer, and maintainable.
>>>
>>> Is there a conventional way to get the data stored in an
>>> std::string? ;-)
>>
>> On second thought, is there really a need to access the underlying
>> data of utf8_t? I argue that having a view of the underlying data via
>> iterators accomplishes just as much(*), and is more inline with the
>> stl tradition of containers and iterators, not to mention the better
>> encapsulation it affords the interface. Do clients really need to
>> know, and potentially develop a dependency on, the fact that utf8_t
>> (for now?) is really just a wrapper for std::string?
>
> For interaction with functions that require std::string, and presumably
> don't care about the encoding, it's convenient. Without it, using the
> UTF classes with such a function requires calling the std::string
> constructor with the element iterators. That's going to be a major need
> for the foreseeable future.

Would that be a bad thing? That is, forcing clients to call the
std::string constructors with element iterators. I don't see it as a
need, but more of a want. It's just a convenience for the clients with
drawbacks for the interface, namely exposing implementation detail that
doesn't need to be exposed.

Mostafa


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