Thread overview
[Issue 10460] std.algorithm: some of algorithms don't use 'auto ref' for front
Aug 19, 2014
Peter Alexander
August 19, 2014
https://issues.dlang.org/show_bug.cgi?id=10460

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

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

--- Comment #1 from Peter Alexander <peter.alexander.au@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.

--
August 29, 2014
https://issues.dlang.org/show_bug.cgi?id=10460

--- Comment #2 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/5e0532b9e7d0a67567db0c7c9a3b541c829c75ed Fix Issue 10460 - auto ref for Union, SetDifference, SetSymmetricDifference

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

The rearrangement of SetSymmetricDifference.front was needed since auto ref doesn't deduce correctly when there are multiple return statements (by design), so a single return statement with the ternary operator was used.

https://github.com/D-Programming-Language/phobos/commit/b61d9fa6844632ced1758f75ba2812c057d34bb8 Merge pull request #2461 from fb-pja/bug10460

Fix Issue 10460 - auto ref Union, SetDifference, SetSymmetricDifference

--
August 29, 2014
https://issues.dlang.org/show_bug.cgi?id=10460

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--