1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
14 // class Alloc = allocator<Value>>
15 // class unordered_set
17 // template <class... Args>
18 // pair<iterator, bool> emplace(Args&&... args);
20 #include <unordered_set>
23 #include "test_macros.h"
24 #include "../../Emplaceable.h"
25 #include "min_allocator.h"
30 typedef std::unordered_set
<Emplaceable
> C
;
31 typedef std::pair
<C::iterator
, bool> R
;
34 assert(c
.size() == 1);
35 assert(*r
.first
== Emplaceable());
38 r
= c
.emplace(Emplaceable(5, 6));
39 assert(c
.size() == 2);
40 assert(*r
.first
== Emplaceable(5, 6));
44 assert(c
.size() == 2);
45 assert(*r
.first
== Emplaceable(5, 6));
49 typedef std::unordered_set
<Emplaceable
, std::hash
<Emplaceable
>,
50 std::equal_to
<Emplaceable
>, min_allocator
<Emplaceable
>> C
;
51 typedef std::pair
<C::iterator
, bool> R
;
54 assert(c
.size() == 1);
55 assert(*r
.first
== Emplaceable());
58 r
= c
.emplace(Emplaceable(5, 6));
59 assert(c
.size() == 2);
60 assert(*r
.first
== Emplaceable(5, 6));
64 assert(c
.size() == 2);
65 assert(*r
.first
== Emplaceable(5, 6));