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 //===----------------------------------------------------------------------===//
15 // iterator insert(value_type&& v);
20 #include "test_macros.h"
22 #include "min_allocator.h"
27 typedef std::multiset
<MoveOnly
> M
;
28 typedef M::iterator R
;
30 R r
= m
.insert(M::value_type(2));
31 assert(r
== m
.begin());
32 assert(m
.size() == 1);
35 r
= m
.insert(M::value_type(1));
36 assert(r
== m
.begin());
37 assert(m
.size() == 2);
40 r
= m
.insert(M::value_type(3));
41 assert(r
== std::prev(m
.end()));
42 assert(m
.size() == 3);
45 r
= m
.insert(M::value_type(3));
46 assert(r
== std::prev(m
.end()));
47 assert(m
.size() == 4);
51 typedef std::multiset
<MoveOnly
, std::less
<MoveOnly
>, min_allocator
<MoveOnly
>> M
;
52 typedef M::iterator R
;
54 R r
= m
.insert(M::value_type(2));
55 assert(r
== m
.begin());
56 assert(m
.size() == 1);
59 r
= m
.insert(M::value_type(1));
60 assert(r
== m
.begin());
61 assert(m
.size() == 2);
64 r
= m
.insert(M::value_type(3));
65 assert(r
== std::prev(m
.end()));
66 assert(m
.size() == 3);
69 r
= m
.insert(M::value_type(3));
70 assert(r
== std::prev(m
.end()));
71 assert(m
.size() == 4);