Skip to content

Commit e832f8e

Browse files
committed
Add a changelog entry for each's early stopping
1 parent a12d990 commit e832f8e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
`std.algorithm.iteration.each` is now capable of early-stopping
2+
3+
$(REF each, std,algorithm,iteration) is now capable of exiting early.
4+
When a `No.each` $(REF Flag, std,typecons) is returned from the function that
5+
is called by `each`, the iteration will be aborted early.
6+
Analogously, returning `Yes.each` will continue the iteration.
7+
For example:
8+
9+
---
10+
auto arr = [10, 20, 30];
11+
arr.each!((n) { arr ~= n; return (n == 20) ? No.each : Yes.each; }); // aborts after the second iteration
12+
assert(arr == [10, 20, 30, 10, 20]);
13+
---

0 commit comments

Comments
 (0)