Skip to content

Commit

Permalink
Fix Issue 18036 - Documentation of moveFront()
Browse files Browse the repository at this point in the history
...fails to mention different behavior depending on
hasElaborateCopyConstructor

The new wording is based on the documentation for core.lifetime.move.
  • Loading branch information
pbackus authored and dlang-bot committed Feb 28, 2022
1 parent 5bc8b25 commit 41aaf8c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions std/range/primitives.d
Expand Up @@ -2055,9 +2055,14 @@ if (isBidirectionalRange!Range)
}

/**
Moves the front of `r` out and returns it. Leaves `r.front` in a
destroyable state that does not allocate any resources (usually equal
to its `.init` value).
Moves the front of `r` out and returns it.
If `r.front` is a struct with a destructor or copy constructor defined, it
is reset to its `.init` value after its value is moved. Otherwise, it is
left unchanged.
In either case, `r.front` is left in a destroyable state that does not
allocate any resources.
*/
ElementType!R moveFront(R)(R r)
{
Expand Down

0 comments on commit 41aaf8c

Please sign in to comment.