Function getAndPopBack
Returns the last element and removes it from the range.
ref auto getAndPopBack(R)
(
ref R range
)
if (isBidirectionalRange!R);
If range has lvalue elements, then getAndPopBack returns by reference, otherwise the returned element is copied.
Parameters
Name | Description |
---|---|
R | Bidirectional range type. |
range | Bidirectional range. |
Returns
Last range element.
See Also
getAndPopFront.
Example
int[3] array = [1, 2, 3];
auto slice = array[];
assert(getAndPopBack(slice) == 3);
assert(slice .length == 2);