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