mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
ADT: Add a drop_back() helper to ArrayRef
The slice(N, M) interface is powerful but not concise when wanting to drop a few elements off of an ArrayRef, fix this by adding a drop_back method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212370 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -29,5 +29,12 @@ TEST(ArrayRefTest, AllocatorCopy) {
|
||||
EXPECT_NE(Array2.data(), Array2c.data());
|
||||
}
|
||||
|
||||
TEST(ArrayRefTest, DropBack) {
|
||||
static const int TheNumbers[] = {4, 8, 15, 16, 23, 42};
|
||||
ArrayRef<int> AR1(TheNumbers);
|
||||
ArrayRef<int> AR2(TheNumbers, AR1.size() - 1);
|
||||
EXPECT_TRUE(AR1.drop_back().equals(AR2));
|
||||
}
|
||||
|
||||
|
||||
} // end anonymous namespace
|
||||
|
Reference in New Issue
Block a user