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.
@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
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
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