1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
12 // class Alloc = allocator<Value>>
13 // class unordered_set
15 // float load_factor() const
17 #include <unordered_set>
22 #include "test_macros.h"
23 #include "min_allocator.h"
28 typedef std::unordered_set
<int> C
;
41 const C
c(std::begin(a
), std::end(a
));
42 assert(std::fabs(c
.load_factor() - (float)c
.size()/c
.bucket_count()) < FLT_EPSILON
);
45 typedef std::unordered_set
<int> C
;
47 assert(c
.load_factor() == 0);
49 #if TEST_STD_VER >= 11
51 typedef std::unordered_set
<int, std::hash
<int>,
52 std::equal_to
<int>, min_allocator
<int>> C
;
65 const C
c(std::begin(a
), std::end(a
));
66 assert(std::fabs(c
.load_factor() - (float)c
.size()/c
.bucket_count()) < FLT_EPSILON
);
69 typedef std::unordered_set
<int, std::hash
<int>,
70 std::equal_to
<int>, min_allocator
<int>> C
;
72 assert(c
.load_factor() == 0);