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(const_iterator position, value_type&& v);
21 #include "test_macros.h"
23 #include "min_allocator.h"
28 typedef std::set
<MoveOnly
> M
;
29 typedef M::iterator R
;
31 R r
= m
.insert(m
.cend(), M::value_type(2));
32 assert(r
== m
.begin());
33 assert(m
.size() == 1);
36 r
= m
.insert(m
.cend(), M::value_type(1));
37 assert(r
== m
.begin());
38 assert(m
.size() == 2);
41 r
= m
.insert(m
.cend(), M::value_type(3));
42 assert(r
== std::prev(m
.end()));
43 assert(m
.size() == 3);
46 r
= m
.insert(m
.cend(), M::value_type(3));
47 assert(r
== std::prev(m
.end()));
48 assert(m
.size() == 3);
52 typedef std::set
<MoveOnly
, std::less
<MoveOnly
>, min_allocator
<MoveOnly
>> M
;
53 typedef M::iterator R
;
55 R r
= m
.insert(m
.cend(), M::value_type(2));
56 assert(r
== m
.begin());
57 assert(m
.size() == 1);
60 r
= m
.insert(m
.cend(), M::value_type(1));
61 assert(r
== m
.begin());
62 assert(m
.size() == 2);
65 r
= m
.insert(m
.cend(), M::value_type(3));
66 assert(r
== std::prev(m
.end()));
67 assert(m
.size() == 3);
70 r
= m
.insert(m
.cend(), M::value_type(3));
71 assert(r
== std::prev(m
.end()));
72 assert(m
.size() == 3);