popBackN

Removes maximum count last elements from the bidirectional range range.

void
popBackN
(
R
)
(
ref R range
,
size_t count
)

Parameters

R

Range type.

range R

Some bidirectional range.

count size_t

Number of elements to remove.

Examples

int[5] a = [1, 2, 3, 4, 5];
auto slice = a[];

popBackN(slice, 3);
assert(slice.length == 2);
assert(slice[0] == 1);
assert(slice[$ - 1] == 2);

popBackN(slice, 20);
assert(slice.length == 0);

See Also

$(D_PSYMBOL popFrontN), $(D_PSYMBOL popBackExactly), $(D_PSYMBOL isBidirectionalRange).

Meta