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// UNSUPPORTED: c++03
10
11// <unordered_set>
12
13// template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
14// class Alloc = allocator<Value>>
15// class unordered_multiset
16
17// void insert(initializer_list<value_type> il);
18
19#include <unordered_set>
20#include <cassert>
21
22#include "test_macros.h"
23#include "test_iterators.h"
24#include "min_allocator.h"
25
26int main(int, char**) {
27 {
28 typedef std::unordered_multiset<int> C;
29 typedef int P;
30 C c;
31 c.insert(l: {P(1), P(2), P(3), P(4), P(1), P(2)});
32 assert(c.size() == 6);
33 assert(c.count(1) == 2);
34 assert(c.count(2) == 2);
35 assert(c.count(3) == 1);
36 assert(c.count(4) == 1);
37 }
38 {
39 typedef std::unordered_multiset<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
40 typedef int P;
41 C c;
42 c.insert({P(1), P(2), P(3), P(4), P(1), P(2)});
43 assert(c.size() == 6);
44 assert(c.count(1) == 2);
45 assert(c.count(2) == 2);
46 assert(c.count(3) == 1);
47 assert(c.count(4) == 1);
48 }
49
50 return 0;
51}
52

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