Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / reference / assign_bool.pass.cpp
blob64dcc3c608214a3077e04d709784bbb071da563f
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 // reference& operator=(bool)
13 #include <cassert>
14 #include <vector>
16 #include "test_macros.h"
18 TEST_CONSTEXPR_CXX20 bool test() {
19 std::vector<bool> vec;
20 typedef std::vector<bool>::reference Ref;
21 vec.push_back(true);
22 vec.push_back(false);
23 Ref ref = vec[0];
24 const Ref cref = vec[0];
26 assert(ref);
27 ref = false;
28 assert(!vec[0]);
29 assert(!vec[1]);
30 ref = true;
31 assert(vec[0]);
32 assert(!vec[1]);
34 assert(cref);
36 #if TEST_STD_VER > 20
37 cref = false;
38 assert(!vec[0]);
39 assert(!vec[1]);
40 cref = true;
41 assert(vec[0]);
42 assert(!vec[1]);
43 #endif
45 return true;
48 int main(int, char**) {
49 test();
50 #if TEST_STD_VER > 17
51 static_assert(test());
52 #endif
54 return 0;