Add a changelog entry for each's early stopping#6668
Conversation
|
Thanks for your pull request, @wilzbach! Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "master + phobos#6668" |
|
|
||
| $(REF each, std,algorithm,iteration) is now capable of exiting early. | ||
| When a `No.each` $(REF Flag, std,typecons) is passed to `each`, the iteration will be aborted early. | ||
| For example: |
There was a problem hiding this comment.
(Minor) I had to read this a couple times to get it. Perhaps better would be if the wording describes what the iteration function returns rather than what is passed to each. A slightly different example showing both yes and no cases might also do this. eg.
auto arr = [10, 20, 30];
arr.each!((n) { arr ~= n; return (n == 20) ? No.each : Yes.each; });
assert(arr == [10, 20, 30, 10, 20]);
There was a problem hiding this comment.
Good idea! I tried to rephrase it and used your proposed example. Thanks!
0834ca3 to
e832f8e
Compare
|
LGTM |
|
Ah damn. It looks like this was merged shortly after the 2.082 branch-off has happened. |
See also: #5268
Preview: