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_multiset
14
15// size_type bucket_count() const;
16
17#include <unordered_set>
18#include <cassert>
19
20#include "test_macros.h"
21#include "min_allocator.h"
22
23int main(int, char**)
24{
25 {
26 typedef std::unordered_multiset<int> C;
27 const C c;
28 LIBCPP_ASSERT(c.bucket_count() == 0);
29 }
30 {
31 typedef std::unordered_multiset<int> C;
32 typedef int P;
33 P a[] =
34 {
35 P(10),
36 P(20),
37 P(30),
38 P(40),
39 P(50),
40 P(60),
41 P(70),
42 P(80)
43 };
44 const C c(std::begin(arr&: a), std::end(arr&: a));
45 assert(c.bucket_count() >= 8);
46 }
47#if TEST_STD_VER >= 11
48 {
49 typedef std::unordered_multiset<int, std::hash<int>,
50 std::equal_to<int>, min_allocator<int>> C;
51 const C c;
52 LIBCPP_ASSERT(c.bucket_count() == 0);
53 }
54 {
55 typedef std::unordered_multiset<int, std::hash<int>,
56 std::equal_to<int>, min_allocator<int>> C;
57 typedef int P;
58 P a[] =
59 {
60 P(10),
61 P(20),
62 P(30),
63 P(40),
64 P(50),
65 P(60),
66 P(70),
67 P(80)
68 };
69 const C c(std::begin(a), std::end(a));
70 assert(c.bucket_count() >= 8);
71 }
72#endif
73
74 return 0;
75}
76

source code of libcxx/test/std/containers/unord/unord.multiset/bucket_count.pass.cpp