First Impressions
Sean Kelly
sean at f4.ca
Sat Sep 30 07:59:10 PDT 2006
Walter Bright wrote:
>
> Contrast that with C++, which has no usable or portable support for
> UTF-8, UTF-16, or any Unicode. All your carefully coded use of
> std::string needs to be totally scrapped and redone with your own custom
> classes, should you decide your app needs to support unicode.
As long as you're aware that you are working in UTF-8 I think
std::string could still be used. It just may be strange to use
substring searches to find multibyte characters with no built-in support
for dchar-type searching.
> You can also wrap char[] inside a class that provides a view of the data
> as if it were dchar's. But I don't think the performance of such a
> class would be competitive. Interestingly, it turns out that most string
> operations do not need to be concerned with the number of char's in a
> character (like "find this substring"), and forcing them to care just
> makes for inefficiency.
Yup. I realized this while working on array operations and it came as a
surprise--when I began I figured I would have to provide overloads for
char strings, but in most cases it simply isn't necessary.
Sean
More information about the Digitalmars-d
mailing list