|
18 | 18 | #include <vector> |
19 | 19 |
|
20 | 20 | #include "min_allocator.h" |
21 | | -#include "poisoned_hash_helper.h" |
| 21 | + |
| 22 | +template <class VBType> |
| 23 | +constexpr void test() { |
| 24 | + bool ba[]{true, false, true, true, false}; |
| 25 | + VBType vb(std::begin(ba), std::end(ba)); |
| 26 | + |
| 27 | + const std::hash<VBType> h{}; |
| 28 | + const auto hash_value = h(vb); |
| 29 | + assert(hash_value == h(vb)); |
| 30 | + assert(hash_value != 0); |
| 31 | +} |
22 | 32 |
|
23 | 33 | constexpr bool test() { |
24 | | - { |
25 | | - using VB = std::vector<bool>; |
26 | | - bool ba[]{true, false, true, true, false}; |
27 | | - VB vb(std::begin(ba), std::end(ba)); |
28 | | - |
29 | | - const std::hash<VB> h{}; |
30 | | - const auto hash_value = h(vb); |
31 | | - assert(hash_value == h(vb)); |
32 | | - assert(hash_value != 0); |
33 | | - } |
34 | | - { |
35 | | - using VB = std::vector<bool, min_allocator<bool>>; |
36 | | - bool ba[] = {true, false, true, true, false}; |
37 | | - VB vb(std::begin(ba), std::end(ba)); |
38 | | - |
39 | | - const std::hash<VB> h{}; |
40 | | - const auto hash_value = h(vb); |
41 | | - assert(hash_value == h(vb)); |
42 | | - assert(hash_value != 0); |
43 | | - } |
| 34 | + test<std::vector<bool>>(); |
| 35 | + test<std::vector<bool, min_allocator<bool>>>(); |
44 | 36 |
|
45 | 37 | return true; |
46 | 38 | } |
|
0 commit comments