1 // { dg-options "-std=gnu++0x" }
3 // 2010-02-10 Paolo Carlini <paolo.carlini@oracle.com>
5 // Copyright (C) 2010 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_set>
24 #include <testsuite_hooks.h>
29 bool test __attribute__((unused)) = true;
31 typedef std::unordered_multiset<std::string> Mset;
32 typedef Mset::iterator iterator;
33 typedef Mset::const_iterator const_iterator;
37 ms1.insert("all the love in the world");
38 ms1.insert("you know what you are?");
39 ms1.insert("the collector");
40 ms1.insert("the hand that feeds");
41 ms1.insert("love is not enough");
42 ms1.insert("every day is exactly the same");
43 ms1.insert("with teeth");
45 ms1.insert("getting smaller");
46 ms1.insert("sunspots");
48 ms1.insert("the hand that feeds");
49 ms1.insert("love is not enough");
50 ms1.insert("every day is exactly the same");
51 VERIFY( ms1.size() == 13 );
53 iterator it1 = ms1.begin();
58 VERIFY( ms1.size() == 12 );
60 iterator it4 = ms1.begin();
68 VERIFY( ms1.size() == 10 );
70 const_iterator it7 = ms1.begin();
74 const_iterator it8 = it7;
77 VERIFY( ms1.size() == 9 );
79 const_iterator it10 = ms1.begin();
81 const_iterator it11 = it10;
86 ms1.erase(it10, it11);
87 VERIFY( ms1.size() == 5 );
89 ms1.erase(ms1.begin(), ms1.end());
90 VERIFY( ms1.size() == 0 );