Small Buffer Optimization for string and friends
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Apr 8 08:06:13 PDT 2012
On 4/8/12 9:59 AM, Michel Fortin wrote:
> But as soon as you take a pointer to that string, you break the
> immutability guaranty:
>
> immutable(char)[] s = "abcd";
> immutable(char)* p = s.ptr;
> s = "defg"; // assigns to where?
Taking .ptr will engender a copy. A small regression will be that
address of individual chars cannot be taken.
Andrei
More information about the Digitalmars-d
mailing list