From: Matt Gruenke (mgruenke_at_[hidden])
Date: 2008-03-04 05:03:45
Phil Endecott wrote:
> Matt Gruenke wrote:
>> Something that might be worth a look is Glib::ustring, in glibmm-2.
> - It uses size_type to pass and return positions in the string, and
> doesn't specify whether these are byte or character positions; I get
> the impression that they're character positions but I could be wrong.
Given that they highlight the pitfalls of byte-based addressing in
std::string (when instantiated with multibyte characters)
might return a byte in the middle of a character, and
returns the number of bytes rather than characters
and that virtually everywhere size_type is used (where there's
documentation), they explicitly state that it describes a number of
characters, I think it's character-based. Also, they provide a bytes()
member function, in addition to size() and length().
> - It offers implicit conversion to and from std::string. Is this desirable?
I feel the danger and potential for confusion easily outweigh the
benefits. I agree that something like a str() member function is the
way to go.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk