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 // iterator insert(const_iterator position, const value_type& v);
18 #include "test_macros.h"
19 #include "min_allocator.h"
24 typedef std::multiset
<int> M
;
25 typedef M::iterator R
;
27 R r
= m
.insert(m
.cend(), M::value_type(2));
28 assert(r
== m
.begin());
29 assert(m
.size() == 1);
32 r
= m
.insert(m
.cend(), M::value_type(1));
33 assert(r
== m
.begin());
34 assert(m
.size() == 2);
37 r
= m
.insert(m
.cend(), M::value_type(3));
38 assert(r
== std::prev(m
.end()));
39 assert(m
.size() == 3);
42 r
= m
.insert(m
.cend(), M::value_type(3));
43 assert(r
== std::prev(m
.end()));
44 assert(m
.size() == 4);
47 #if TEST_STD_VER >= 11
49 typedef std::multiset
<int, std::less
<int>, min_allocator
<int>> M
;
50 typedef M::iterator R
;
52 R r
= m
.insert(m
.cend(), M::value_type(2));
53 assert(r
== m
.begin());
54 assert(m
.size() == 1);
57 r
= m
.insert(m
.cend(), M::value_type(1));
58 assert(r
== m
.begin());
59 assert(m
.size() == 2);
62 r
= m
.insert(m
.cend(), M::value_type(3));
63 assert(r
== std::prev(m
.end()));
64 assert(m
.size() == 3);
67 r
= m
.insert(m
.cend(), M::value_type(3));
68 assert(r
== std::prev(m
.end()));
69 assert(m
.size() == 4);