Templates: Array slices not recognized

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 20 03:23:54 PDT 2015


On Mon, 20 Apr 2015 10:14:25 +0000, Chris wrote:

> string a = "bla";
> string b = "blub";
> 
> auto res = doSomething(a, b);
> 
> If I didn't use "auto ref" or "ref", string would get copied, wouldn't
> it?

no, it wont -- not unless you'll append something to it. slicing arrays 
(and string is array too) will never copy anything.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150420/57a4229c/attachment.sig>


More information about the Digitalmars-d-learn mailing list