1 // { dg-do run { target c++11 } }
3 // 2012-01-19 Jakub Jelinek <jakub@redhat.com>
5 // Copyright (C) 2012-2025 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
22 #include <unordered_map>
23 #include <testsuite_hooks.h>
28 typedef std::unordered_multimap
<int, int> Mmap
;
29 typedef Mmap::iterator iterator
;
30 typedef Mmap::const_iterator const_iterator
;
31 typedef Mmap::value_type value_type
;
35 mm1
.insert(value_type(11135, 1));
36 mm1
.insert(value_type(11135, 17082));
37 mm1
.insert(value_type(9644, 24135));
38 mm1
.insert(value_type(9644, 9644));
39 mm1
.insert(value_type(13984, 19841));
40 mm1
.insert(value_type(9644, 1982));
41 mm1
.insert(value_type(13984, 1945));
42 mm1
.insert(value_type(7, 1982));
43 mm1
.insert(value_type(7, 1945));
44 VERIFY( mm1
.size() == 9 );
46 iterator it1
= mm1
.begin();
51 iterator it3
= mm1
.erase(it1
, it2
);
52 VERIFY( mm1
.size() == 7 );
54 VERIFY( *it3
== *it2
);
56 const_iterator it4
= mm1
.begin();
58 const_iterator it5
= it4
;
60 const_iterator it6
= mm1
.erase(it4
);
61 VERIFY( mm1
.size() == 6 );
63 VERIFY( *it6
== *it5
);