1 // 2005-10-08 Paolo Carlini <pcarlini@suse.de>
3 // Copyright (C) 2005 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 2, 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 COPYING. If not, write to the Free
18 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // 6.3.4.5 Class template unordered_multiset
23 #include <tr1/unordered_set>
25 #include <testsuite_hooks.h>
30 bool test
__attribute__((unused
)) = true;
32 typedef std::tr1::unordered_multiset
<std::string
> Mset
;
33 typedef Mset::iterator iterator
;
34 typedef Mset::const_iterator const_iterator
;
38 ms1
.insert("all the love in the world");
39 ms1
.insert("you know what you are?");
40 ms1
.insert("the collector");
41 ms1
.insert("the hand that feeds");
42 ms1
.insert("love is not enough");
43 ms1
.insert("every day is exactly the same");
44 ms1
.insert("with teeth");
46 ms1
.insert("getting smaller");
47 ms1
.insert("sunspots");
49 ms1
.insert("the hand that feeds");
50 ms1
.insert("love is not enough");
51 ms1
.insert("every day is exactly the same");
52 VERIFY( ms1
.size() == 13 );
54 iterator it1
= ms1
.begin();
58 iterator it3
= ms1
.erase(it1
);
59 VERIFY( ms1
.size() == 12 );
61 VERIFY( *it3
== *it2
);
63 iterator it4
= ms1
.begin();
70 iterator it6
= ms1
.erase(it4
, it5
);
71 VERIFY( ms1
.size() == 10 );
73 VERIFY( *it6
== *it5
);
75 const_iterator it7
= ms1
.begin();
79 const_iterator it8
= it7
;
81 const_iterator it9
= ms1
.erase(it7
);
82 VERIFY( ms1
.size() == 9 );
84 VERIFY( *it9
== *it8
);
86 const_iterator it10
= ms1
.begin();
88 const_iterator it11
= it10
;
93 const_iterator it12
= ms1
.erase(it10
, it11
);
94 VERIFY( ms1
.size() == 5 );
95 VERIFY( it12
== it11
);
96 VERIFY( *it12
== *it11
);
98 iterator it13
= ms1
.erase(ms1
.begin(), ms1
.end());
99 VERIFY( ms1
.size() == 0 );
100 VERIFY( it13
== ms1
.end() );
101 VERIFY( it13
== ms1
.begin() );