[Interest] Why QString and not std::string?
BRM
bm_witness at yahoo.com
Fri Jun 15 17:56:01 CEST 2012
> From: Till Oliver Knoll <till.oliver.knoll at gmail.com>
>2012/6/15 Rui Maciel <rui.maciel at gmail.com>:
>>>> Nevertheless, why is it important to support UTF-16?
>>>
>>> 1. Faster string search modification than for UTF8
>>> 2. It's native UTF string format on Windows and Mac OS X.
>>
>> How relevant is the efficiency of string search modification operations?
>
>EXTREMELY relevant! While not every application is constantly digging
>through piles of text, I would dare to say that string operations
>(concatenation, search, replace, regexp, ...) are one of the most
>common operations that applications do. And be it just the parsing of
>config files.
>
>> And what string data type is used in C++ projects that target Windows
>> or OSX?
>
>Guess what: UTF-16 ;) (that's the internal data format of QString).
And to top it off, last I checked std::wstring on Linux (with GCC's libstdc++ at least) was UTF-32.
Yeah, that bit me a few weeks back when I was trying to write a Standard C/C++ library for an in-house file format
that only specified that certain fields were wide-characters in Unicode. The original code was all Win32 stuff
and the author didn't think to note in anything that it was UTF-16. So I had to write a little converter for what
I needed as C++11 is not available in all my build environments yet after figuring out that was what the problem was.
Ben
More information about the Interest
mailing list