Invariant strings on Dr. Dobb's
Walter Bright
newshound1 at digitalmars.com
Thu Mar 13 20:09:40 PDT 2008
BCS wrote:
> You say that the common ops generally don't mutate the data and then
> list "moving references around, slicing, and concatenating". I guess my
> thought is that the first two are a bit more self explanatory than the
> last. Clearly 1 & 2 are non mutating but, a guy who is a few Lattes
> behind might not notice that because you, in general, don't known what
> comes after a string, if you want to extend a string (for
> concatenating), you need to allocate new ram for it, thus leaving the
> first blocks untouched. (I'm not thinking specific to D here).
All I meant was that a common operation is concatenating - an operation
that in C is usually done by allocating a mutable buffer, then copying
the strings into it.
More information about the Digitalmars-d-announce
mailing list