HomePhabricator

[ADT] Add SmallVector::pop_back_n

Authored by njames93 on Nov 3 2020, 6:57 AM.

Description

[ADT] Add SmallVector::pop_back_n

Adds a method called pop_back_n to SmallVector.
This is more readable and less error prone than the alternatives of using

Vector.resize(Vector.size() - N);
Vector.erase(Vector.end() - N, Vector.end());
for (unsigned I = 0;I<N;++I) Vector.pop_back();

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D90576

Details

Committed
njames93Nov 3 2020, 6:57 AM
Reviewer
dblaikie
Differential Revision
D90576: [ADT] Add SmallVector::pop_back_n
Parents
rGe8d67ef2dc93: [SLP][X86][Test] Extend test coverage for PR47629
Branches
Unknown
Tags
Unknown