From: Bohdan (warever_at_[hidden])
Date: 2002-10-03 15:18:52
"David B. Held" <dheld_at_[hidden]> wrote in message
> "Bohdan" <warever_at_[hidden]> wrote in message
> > I'd like to propose immutable string class, i.e. string that has
> > immutable contents which can be pooled. IMHO immutable_string
> > is better candidate for various "name" properties than std::string.
> > [...]
> I'm very interested in this class. What would be nice is a COW
> wrapper for it as well.
if COW == "copy on write" than i do not understand your idea.
immutable_string is ref-counted string and all values are stored in pool
Each specific value has only one instance in pool and it has nothing to do
> As I understand it, std::string may be
> implemented as ref-counted with COW, but generally is not.
Some stl implementations have ref-counted strings or some variations.
> I have an application where strings will tend to remain the same,
> but I'd like to modify them, even if that means creating a new copy,
> and sharing the old version.
Still do not understand. Maybe name immutable_string isn't ok.
immutable_string instance can be modified as with normal string:
void f( immutable_string & str )
str = "something else";
But when you want access value as ::std::string/c-string you can use
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk