[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / vector.bool / vector_bool.pass.cpp
blobe2cf53ec6bd3a826dcd5085a7c1382a760de7cb3
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 // <functional>
11 // template <class T>
12 // struct hash
13 // : public unary_function<T, size_t>
14 // {
15 // size_t operator()(T val) const;
16 // };
18 // Not very portable
20 #include <vector>
21 #include <cassert>
22 #include <type_traits>
24 #include "test_macros.h"
25 #include "min_allocator.h"
27 int main(int, char**)
30 typedef std::vector<bool> T;
31 typedef std::hash<T> H;
32 static_assert((std::is_same<H::argument_type, T>::value), "" );
33 static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
34 ASSERT_NOEXCEPT(H()(T()));
36 bool ba[] = {true, false, true, true, false};
37 T vb(std::begin(ba), std::end(ba));
38 H h;
39 assert(h(vb) != 0);
41 #if TEST_STD_VER >= 11
43 typedef std::vector<bool, min_allocator<bool>> T;
44 typedef std::hash<T> H;
45 static_assert((std::is_same<H::argument_type, T>::value), "" );
46 static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
47 ASSERT_NOEXCEPT(H()(T()));
48 bool ba[] = {true, false, true, true, false};
49 T vb(std::begin(ba), std::end(ba));
50 H h;
51 assert(h(vb) != 0);
53 #endif
55 return 0;