On Sun, 28 May 2006 20:58:48 +0200, "Alf P. Steinbach"
<al***@start.no > wrote:
An immutable string class is different from 'std::string const' in that
its operations do not carry the overhead associated with mutability, and
that it supports assignment and thus can be used in standard containers.
Functionalit y-wise it is similar to
typedef boost::shared_p tr<std::string const> ValueString;
Actually, that should be avoided! Immutable objects make only sense as
immutable value objects. In C++ (not in Java) 'value object' means
that an assignment replaces (=mutates) the original object, not just a
reference to it. A totally immutable value object would not be very
useful in C++ (e.g. you could not assign a return value). I asked some
time ago for a name for 'assignable-but-otherwise-immutable-objects'.
The concept seems to be known but there is no established name for it.
http://groups.google.com/group/comp....1ef8b7634c0dc7
Best regards,
Roland Pibinger