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

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