53 lines · cpp
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-exception6//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_multiset14 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 typedef std::unordered_multiset<int> C;26 const C c;27 LIBCPP_ASSERT(c.bucket_count() == 0);28 }29 {30 typedef std::unordered_multiset<int> C;31 typedef int P;32 P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};33 const C c(std::begin(a), std::end(a));34 assert(c.bucket_count() >= 8);35 }36#if TEST_STD_VER >= 1137 {38 typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;39 const C c;40 LIBCPP_ASSERT(c.bucket_count() == 0);41 }42 {43 typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;44 typedef int P;45 P a[] = {P(10), P(20), P(30), P(40), P(50), P(60), P(70), P(80)};46 const C c(std::begin(a), std::end(a));47 assert(c.bucket_count() >= 8);48 }49#endif50 51 return 0;52}53