About Strings

Enrico Weigelt enrico.weigelt at vnc.biz
Mon Mar 19 09:31:32 PDT 2012


> the historical reason is that std::string is part of the C++
> standard
> library, and implementations of that generally only started to
> become
> actually usable on all platforms in the early 2000s.
 
Okay, that shouldn't be an real argument, when we're talking about
refactoring anyways ;-)
 
> the other reason is that std::string isn't particularly well suited
> to
> storing Unicode, because all of the operations on it are defined in
> terms of elements of an array.  so when using std::string accessing
> UTF-8 characters is both cumbersome and error-prone, while using
> std::wstring is not an option at all because it is based on
> wchar_t,
> and
> the geniuses didn't define whether that is 16bit or 32bit, so it's
> _completely_ useless in practice.  the only option really would be
> to
> use something like std;:basic_string<uint32_t>, but that wastes a
> lot
> of
> space in the common case, or std::basic_string<uint16_t>, which is
> just
> as stupid as our existing rtl::OUString.
 
hmm, already guessed that ;-o

Wouldn't this call for an extension of std::string (derived class)
or an generic helper class ?
 
Does anyone know whether libraries like boost have a good
solution for that ?


cu
--
Mit freundlichen Grüßen / Kind regards

Enrico Weigelt
VNC - Virtual Network Consult GmbH
Development

Äußere Bayreuther Str. 55, D - 90409 Nürnberg
Tel: +49 911 72303-30
Fax: +49 911 72303-50

enrico.weigelt at vnc.biz; www.vnc.de


More information about the LibreOffice mailing list