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 | //===----------------------------------------------------------------------===// |
8 | |
9 | // <unordered_map> |
10 | |
11 | // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, |
12 | // class Alloc = allocator<pair<const Key, T>>> |
13 | // class unordered_multimap |
14 | |
15 | // float max_load_factor() const; |
16 | // void max_load_factor(float mlf); |
17 | |
18 | #include <unordered_map> |
19 | #include <string> |
20 | #include <cassert> |
21 | |
22 | #include "test_macros.h" |
23 | #include "min_allocator.h" |
24 | |
25 | int main(int, char**) { |
26 | { |
27 | typedef std::unordered_multimap<int, std::string> C; |
28 | const C c; |
29 | assert(c.max_load_factor() == 1); |
30 | } |
31 | { |
32 | typedef std::unordered_multimap<int, std::string> C; |
33 | C c; |
34 | assert(c.max_load_factor() == 1); |
35 | c.max_load_factor(z: 2.5); |
36 | assert(c.max_load_factor() == 2.5); |
37 | } |
38 | #if TEST_STD_VER >= 11 |
39 | { |
40 | typedef std::unordered_multimap<int, |
41 | std::string, |
42 | std::hash<int>, |
43 | std::equal_to<int>, |
44 | min_allocator<std::pair<const int, std::string>>> |
45 | C; |
46 | const C c; |
47 | assert(c.max_load_factor() == 1); |
48 | } |
49 | { |
50 | typedef std::unordered_multimap<int, |
51 | std::string, |
52 | std::hash<int>, |
53 | std::equal_to<int>, |
54 | min_allocator<std::pair<const int, std::string>>> |
55 | C; |
56 | C c; |
57 | assert(c.max_load_factor() == 1); |
58 | c.max_load_factor(2.5); |
59 | assert(c.max_load_factor() == 2.5); |
60 | } |
61 | #endif |
62 | |
63 | return 0; |
64 | } |
65 | |