1 // { dg-do run { target c++11 } }
3 // Copyright (C) 2009-2024 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
21 // NOTE: This makes use of the fact that we know how moveable
22 // is implemented on multiset (via swap). If the implementation changed
23 // this test may begin to fail.
27 #include <testsuite_hooks.h>
36 multimap
<int, int> mm0
;
37 typedef multimap
<int, int>::iterator iterator
;
38 typedef multimap
<int, int>::const_iterator const_iterator
;
39 typedef multimap
<int, int>::value_type value_type
;
40 typedef iterator insert_return_type
;
42 vector
<insert_return_type
> irt
;
43 for (int i
= 1; i
<= 4; ++i
)
44 for (int j
= 1; j
<= i
; ++j
)
45 irt
.push_back( mm0
.insert( value_type( i
, i
) ) );
47 iterator pos1
= mm0
.erase(irt
[1]);
48 VERIFY( pos1
== irt
[2] );
50 iterator pos2
= mm0
.erase(irt
[2]);
51 VERIFY( pos2
== irt
[3] );
53 iterator pos3
= mm0
.erase(irt
[9]);
54 VERIFY( pos3
== mm0
.end() );
62 multimap
<int, int> mm0
;
63 typedef multimap
<int, int>::iterator iterator
;
64 typedef multimap
<int, int>::const_iterator const_iterator
;
65 typedef multimap
<int, int>::value_type value_type
;
66 typedef iterator insert_return_type
;
68 vector
<insert_return_type
> irt
;
69 for (int i
= 1; i
<= 4; ++i
)
70 for (int j
= 1; j
<= i
; ++j
)
71 irt
.push_back( mm0
.insert( value_type( i
, i
) ) );
73 iterator pos1
= mm0
.erase(irt
[3], irt
[6]);
74 VERIFY( pos1
== irt
[6] );
76 iterator pos2
= mm0
.erase(irt
[6], ++irt
[9]);
77 VERIFY( pos2
== mm0
.end() );