[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / containers / associative / multimap / multimap.modifiers / insert_iter_cv.pass.cpp
blob81529600ca0af179f698fbd48007d46ed3aaec8e
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 //===----------------------------------------------------------------------===//
9 // <map>
11 // class multimap
13 // iterator insert(const_iterator position, const value_type& v);
15 #include <map>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "min_allocator.h"
21 template <class Container>
22 void do_insert_hint_test()
24 typedef Container M;
25 typedef typename M::iterator R;
26 typedef typename M::value_type VT;
27 M m;
28 const VT v1(2, 2.5);
29 R r = m.insert(m.end(), v1);
30 assert(r == m.begin());
31 assert(m.size() == 1);
32 assert(r->first == 2);
33 assert(r->second == 2.5);
35 const VT v2(1, 1.5);
36 r = m.insert(m.end(), v2);
37 assert(r == m.begin());
38 assert(m.size() == 2);
39 assert(r->first == 1);
40 assert(r->second == 1.5);
42 const VT v3(3, 3.5);
43 r = m.insert(m.end(), v3);
44 assert(r == std::prev(m.end()));
45 assert(m.size() == 3);
46 assert(r->first == 3);
47 assert(r->second == 3.5);
49 const VT v4(3, 4.5);
50 r = m.insert(std::prev(m.end()), v4);
51 assert(r == std::prev(m.end(), 2));
52 assert(m.size() == 4);
53 assert(r->first == 3);
54 assert(r->second == 4.5);
57 int main(int, char**)
59 do_insert_hint_test<std::multimap<int, double> >();
60 #if TEST_STD_VER >= 11
62 typedef std::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
63 do_insert_hint_test<M>();
65 #endif
67 return 0;