Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector / vector.capacity / empty.pass.cpp
blobad4d7b310af7641d32c5740bd6e09e841813ddd4
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 // class vector
13 // bool empty() const noexcept;
15 #include <vector>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "min_allocator.h"
21 TEST_CONSTEXPR_CXX20 bool tests() {
23 typedef std::vector<int> C;
24 C c;
25 ASSERT_NOEXCEPT(c.empty());
26 assert(c.empty());
27 c.push_back(C::value_type(1));
28 assert(!c.empty());
29 c.clear();
30 assert(c.empty());
32 #if TEST_STD_VER >= 11
34 typedef std::vector<int, min_allocator<int>> C;
35 C c;
36 ASSERT_NOEXCEPT(c.empty());
37 assert(c.empty());
38 c.push_back(C::value_type(1));
39 assert(!c.empty());
40 c.clear();
41 assert(c.empty());
44 typedef std::vector<int, safe_allocator<int>> C;
45 C c;
46 ASSERT_NOEXCEPT(c.empty());
47 assert(c.empty());
48 c.push_back(C::value_type(1));
49 assert(!c.empty());
50 c.clear();
51 assert(c.empty());
53 #endif
55 return true;
58 int main(int, char**)
60 tests();
61 #if TEST_STD_VER > 17
62 static_assert(tests());
63 #endif
64 return 0;