Boost logo

Boost Users :

From: David Demelier (markand_at_[hidden])
Date: 2019-10-28 08:35:28


Le 26/10/2019 à 03:11, Zach Laine via Boost-users a écrit :
> About 14 months ago I posted the same thing.  There was significant work
> that needed to be done to Boost.Text (the proposed library), and I was a
> bit burned out.
>
> Now I've managed to make the necessary changes, and I feel the library
> is ready for review, if there is interest.
>
> This library, in part, is something I want to standardize.
>
> It started as a better string library for namespace "std2", with minimal
> Unicode support.  Though "std2" will almost certainly never happen now,
> those string types are still in there, and the library has grown to also
> include all the Unicode features most users will ever need.
>
> Github: https://github.com/tzlaine/text
> Online docs: https://tzlaine.github.io/text

I've read the intro on why is std::string so bad and I have to disagree
with many points.

1. The Fat Interface

In which way is std::string bloat? Of course some functions are probably
here as synonymous but to say it's bloat is kinda false. Just look at
Java's String numerous functions instead [0].

And I

2. The Missing Unicode Support

Yes, many newcomers may be surprised to see that a string "é" has a size
of 2 bytes (assuming UTF-8). But it's also the case of UTF-16 strings
which may have surrotage pairs...

UTF-8 is the way to go and effectively stored. One could argue that we
should have some utf8 iterators or things like that. But std::string is
still a good candidate for string manipulations.

3. Miscellaneous Limitations

Not thread-safe being an issue? Thanks god it is not. Imagine the
overhead of a threadsafe version of a string. The purpose of a library
is not to be threadsafe on every objects. This has to be on the user side.

That said, I really hope for a better unicode support in std:: in the
near future. Your library is well designed and API is clean, I hope it
could be added in Boost :-).

[0]: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net