From 555284916237ed2843d6e1dc6809ac338d822c17 Mon Sep 17 00:00:00 2001 From: Sebastian Wilzbach Date: Thu, 16 Aug 2018 01:18:54 +0200 Subject: [PATCH] Add a changelog entry for each's early stopping --- .../std-algorithm-iteration-each-early-stopping.dd | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 changelog/std-algorithm-iteration-each-early-stopping.dd diff --git a/changelog/std-algorithm-iteration-each-early-stopping.dd b/changelog/std-algorithm-iteration-each-early-stopping.dd new file mode 100644 index 00000000000..9349312973a --- /dev/null +++ b/changelog/std-algorithm-iteration-each-early-stopping.dd @@ -0,0 +1,13 @@ +`std.algorithm.iteration.each` is now capable of early-stopping + +$(REF each, std,algorithm,iteration) is now capable of exiting early. +When a `No.each` $(REF Flag, std,typecons) is returned from the function that +is called by `each`, the iteration will be aborted early. +Analogously, returning `Yes.each` will continue the iteration. +For example: + +--- +auto arr = [10, 20, 30]; +arr.each!((n) { arr ~= n; return (n == 20) ? No.each : Yes.each; }); // aborts after the second iteration +assert(arr == [10, 20, 30, 10, 20]); +---