Bug 21337 – join can iterates ranges multiple times

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-10-22T13:06:49Z
Last change time
2020-11-13T03:43:22Z
Keywords
pull
Assigned to
No Owner
Creator
Richard Manthorpe

Comments

Comment #0 by rmanth — 2020-10-22T13:06:49Z
class Once { bool empty; void popFront() { empty = true; } int front() { return 0; } } void main() { import std.array : join; import std.algorithm.iteration : map; assert([1, 2].map!"[a]".join(new Once) == [1, 0, 2]); // fails } Join iterates `Once` once to make an array and again for each separator, which obviously doesn't work.
Comment #1 by dlang-bot — 2020-10-22T13:12:52Z
@rmanthorpe created dlang/phobos pull request #7674 "Fix Issue 21337: Join can iterate ranges multiple times" fixing this issue: - Fix Issue 21337: Join can iterates ranges multiple times https://github.com/dlang/phobos/pull/7674
Comment #2 by dlang-bot — 2020-10-23T18:47:54Z
dlang/phobos pull request #7674 "Fix Issue 21337: Join can iterate ranges multiple times" was merged into stable: - 529a28ce185375a793d16a84a4a05b2786af39b4 by Richard Manthorpe: Fix Issue 21337: Join can iterate ranges multiple times https://github.com/dlang/phobos/pull/7674
Comment #3 by dlang-bot — 2020-11-13T03:43:22Z
dlang/phobos pull request #7692 "merge stable" was merged into master: - 10e862b458fe1b359ab050a08c8f4777a4c3cf7e by Richard Manthorpe: Fix Issue 21337: Join can iterate ranges multiple times https://github.com/dlang/phobos/pull/7692