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// template <class... Args>
18// iterator emplace(Args&&... args);
19
20#include <unordered_set>
21#include <cassert>
22
23#include "test_macros.h"
24#include "../../Emplaceable.h"
25#include "min_allocator.h"
26
27int main(int, char**)
28{
29 {
30 typedef std::unordered_multiset<Emplaceable> C;
31 typedef C::iterator R;
32 C c;
33 R r = c.emplace();
34 assert(c.size() == 1);
35 assert(*r == Emplaceable());
36
37 r = c.emplace(Emplaceable(5, 6));
38 assert(c.size() == 2);
39 assert(*r == Emplaceable(5, 6));
40
41 r = c.emplace(5, 6);
42 assert(c.size() == 3);
43 assert(*r == Emplaceable(5, 6));
44 }
45 {
46 typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>,
47 std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C;
48 typedef C::iterator R;
49 C c;
50 R r = c.emplace();
51 assert(c.size() == 1);
52 assert(*r == Emplaceable());
53
54 r = c.emplace(Emplaceable(5, 6));
55 assert(c.size() == 2);
56 assert(*r == Emplaceable(5, 6));
57
58 r = c.emplace(5, 6);
59 assert(c.size() == 3);
60 assert(*r == Emplaceable(5, 6));
61 }
62
63 return 0;
64}
65

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