[Issue 10460] std.algorithm: some of algorithms don't use 'auto ref' for front

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 19 14:07:52 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=10460

Peter Alexander <peter.alexander.au at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |peter.alexander.au at gmail.co
                   |                            |m

--- Comment #1 from Peter Alexander <peter.alexander.au at gmail.com> ---
SetIntersection and SetUnion may be confusing to return auto ref since they
contain overlap, e.g.

int[] a = [1, 2, 3];
int[] b = [2, 3, 4];
foreach (ref e; setIntersection(a, b))
    e = 0;

Does this change the elements of 'a' or 'b'?

For the difference ones, it makes sense because the element is only in one of
the sets.

--


More information about the Digitalmars-d-bugs mailing list