Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / find.pass.cpp
blob73cca82e79f11c1c15d19e1052dfe65df2bc8b8e
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>
10 // vector<bool>
12 // std::find with vector<bool>::iterator
14 // https://llvm.org/PR16816
16 #include <vector>
17 #include <algorithm>
18 #include <cassert>
19 #include <cstddef>
21 #include "test_macros.h"
23 TEST_CONSTEXPR_CXX20 bool tests()
26 for (unsigned i = 1; i < 256; ++i)
28 std::vector<bool> b(i,true);
29 std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), false);
30 assert(static_cast<std::size_t>(j-b.begin()) == i);
31 assert(b.end() == j);
35 for (unsigned i = 1; i < 256; ++i)
37 std::vector<bool> b(i,false);
38 std::vector<bool>::iterator j = std::find(b.begin()+1, b.end(), true);
39 assert(static_cast<std::size_t>(j-b.begin()) == i);
40 assert(b.end() == j);
44 return true;
47 int main(int, char**)
49 tests();
50 #if TEST_STD_VER > 17
51 static_assert(tests());
52 #endif
53 return 0;