immutable strings vs std::string
Posted
by Caspin
on Stack Overflow
See other posts from Stack Overflow
or by Caspin
Published on 2010-05-26T20:05:56Z
Indexed on
2010/05/26
20:11 UTC
Read the original article
Hit count: 335
I've recent been reading about immutable strings, here and here as well some stuff about why D chose immutable strings. There seem to be many advantages.
- trivially thread safe
- more secure
- more memory efficient in most use cases.
- cheap substrings (tokenizing and slicing)
Not to mention most new languages have immutable strings, D2.0, Java, C#, Python, Ruby, etc.
Would C++ benefit from immutable strings?
Is it possible to implement an immutable string class in c++ (or c++0x) that would have all of these advantages?
© Stack Overflow or respective owner