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 count(const key_type& k) 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 typedef int P;
28 P a[] =
29 {
30 P(10),
31 P(20),
32 P(30),
33 P(40),
34 P(50),
35 P(50),
36 P(50),
37 P(60),
38 P(70),
39 P(80)
40 };
41 const C c(std::begin(arr&: a), std::end(arr&: a));
42 assert(c.count(30) == 1);
43 assert(c.count(50) == 3);
44 assert(c.count(5) == 0);
45 }
46#if TEST_STD_VER >= 11
47 {
48 typedef std::unordered_multiset<int, std::hash<int>,
49 std::equal_to<int>, min_allocator<int>> C;
50 typedef int P;
51 P a[] =
52 {
53 P(10),
54 P(20),
55 P(30),
56 P(40),
57 P(50),
58 P(50),
59 P(50),
60 P(60),
61 P(70),
62 P(80)
63 };
64 const C c(std::begin(a), std::end(a));
65 assert(c.count(30) == 1);
66 assert(c.count(50) == 3);
67 assert(c.count(5) == 0);
68 }
69#endif
70
71 return 0;
72}
73

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