[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / vector / vector.modifiers / pop_back.pass.cpp
blob386328405d01ac016449e1e548de6c84734355e4
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <vector>
11 // void pop_back();
13 #include <vector>
14 #include <cassert>
16 #include "test_macros.h"
17 #include "test_allocator.h"
18 #include "min_allocator.h"
21 int main(int, char**)
24 std::vector<int> c;
25 c.push_back(1);
26 assert(c.size() == 1);
27 c.pop_back();
28 assert(c.size() == 0);
31 #if TEST_STD_VER >= 11
33 std::vector<int, min_allocator<int>> c;
34 c.push_back(1);
35 assert(c.size() == 1);
36 c.pop_back();
37 assert(c.size() == 0);
39 #endif
41 { // LWG 526
42 int arr[] = {0, 1, 2, 3, 4};
43 int sz = 5;
44 std::vector<int> c(arr, arr+sz);
45 while (c.size() < c.capacity())
46 c.push_back(sz++);
47 c.push_back(c.front());
48 assert(c.back() == 0);
49 for (int i = 0; i < sz; ++i)
50 assert(c[i] == i);
53 return 0;