Bug 10460 – std.algorithm: some of algorithms don't use 'auto ref' for front
Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-06-24T04:16:00Z
Last change time
2014-08-29T20:55:39Z
Assigned to
nobody
Creator
lomereiter
Comments
Comment #0 by lomereiter — 2013-06-24T04:16:05Z
The following should use 'auto ref':
Until, SetDifference, SetSymmetricDifference, SetIntersection, SetUnion
(sorry, I'm too lazy to make a pull request...)
Comment #1 by peter.alexander.au — 2014-08-19T21:07:52Z
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.
Comment #2 by github-bugzilla — 2014-08-29T20:55:38Z