1 // { dg-options "-std=gnu++0x" }
3 // 2012-01-19 Jakub Jelinek <jakub@redhat.com>
5 // Copyright (C) 2012-2013 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 bool test __attribute__((unused)) = true;
30 typedef std::unordered_multimap<int, int> Mmap;
31 typedef Mmap::iterator iterator;
32 typedef Mmap::const_iterator const_iterator;
33 typedef Mmap::value_type value_type;
37 mm1.insert(value_type(11135, 1));
38 mm1.insert(value_type(11135, 17082));
39 mm1.insert(value_type(9644, 24135));
40 mm1.insert(value_type(9644, 9644));
41 mm1.insert(value_type(13984, 19841));
42 mm1.insert(value_type(9644, 1982));
43 mm1.insert(value_type(13984, 1945));
44 mm1.insert(value_type(7, 1982));
45 mm1.insert(value_type(7, 1945));
46 VERIFY( mm1.size() == 9 );
48 iterator it1 = mm1.begin();
53 iterator it3 = mm1.erase(it1, it2);
54 VERIFY( mm1.size() == 7 );
56 VERIFY( *it3 == *it2 );
58 const_iterator it4 = mm1.begin();
60 const_iterator it5 = it4;
62 const_iterator it6 = mm1.erase(it4);
63 VERIFY( mm1.size() == 6 );
65 VERIFY( *it6 == *it5 );