popBackExactly

Removes exactly count last elements from the bidirectional range range.

R must have length or be infinite.

void
popBackExactly
(
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[];

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

popBackExactly(slice, 2);
assert(slice.length == 0);

See Also

$(D_PSYMBOL popFrontExactly), $(D_PSYMBOL popBackN), $(D_PSYMBOL isBidirectionalRange), $(D_PSYMBOL hasLength), $(D_PSYMBOL isInfinite).

Precondition: If R has length, it must be less than or equal to count.

Meta