From: loufoque (mathias.gaunard_at_[hidden])
Date: 2007-08-09 17:09:23
Hervé Brönnimann wrote:
> A shared string would be *extremely* useful. Most of the projects
> I'm working on these days spend a non-negligible time copying strings...
> FWIW, HB
A special data structure was designed for that, it's called a rope.
It allows various substrings to be shared by different strings.
However, it is not much used because:
- A lot of existing code wants efficient ways to have contiguous strings,
- A lot of people consider sharing to be evil (and sometimes rightly so.
I don't see the point of sharing only at the whole string level.
Libraries that produce needless copies are simply ill-designed, and thus
it is true great parts of the standard library are),
- Sharing, if used, works way better with immutable objects.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk