Skip to content

Commit e0f6d50

Browse files
authored
Document transience of elements in .permutations. (#10835)
1 parent 2d8ae67 commit e0f6d50

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

std/algorithm/iteration.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8161,6 +8161,13 @@ Returns:
81618161
A $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives)
81628162
of elements of which are an $(REF indexed, std,range) view into `r`.
81638163
8164+
Note:
8165+
The elements of the resulting range reuse the same internal buffer of
8166+
permutations, so each element is invalidated by `popFront`. If copies of
8167+
intermediate permutations are desired, they need to be individually copied,
8168+
such as using `.map!(e => e.array)` to save them in individual, independent
8169+
arrays.
8170+
81648171
See_Also:
81658172
$(REF nextPermutation, std,algorithm,sorting).
81668173
*/

0 commit comments

Comments
 (0)