mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
Add Vector::remove().
This commit is contained in:
parent
750b27cb07
commit
7777c8844b
2 changed files with 47 additions and 2 deletions
28
AK/test.cpp
28
AK/test.cpp
|
@ -127,5 +127,33 @@ int main(int, char**)
|
|||
problem.append("test");
|
||||
}
|
||||
|
||||
{
|
||||
auto printInts = [] (const Vector<int>& v) {
|
||||
printf("Vector {\n size: %u\n capacity: %u\n elements: ", v.size(), v.capacity());
|
||||
for (auto i : v)
|
||||
printf("%d ", i);
|
||||
printf("\n}\n");
|
||||
};
|
||||
|
||||
Vector<int> v;
|
||||
v.append(0);
|
||||
v.append(1);
|
||||
v.append(2);
|
||||
v.append(3);
|
||||
printInts(v);
|
||||
|
||||
v.remove(1);
|
||||
printInts(v);
|
||||
|
||||
v.remove(0);
|
||||
printInts(v);
|
||||
|
||||
v.remove(0);
|
||||
printInts(v);
|
||||
|
||||
v.remove(0);
|
||||
printInts(v);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue