1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
13 // size_type erase(const key_type& k);
18 #include "test_macros.h"
19 #include "min_allocator.h"
24 typedef std::multiset
<int> M
;
26 typedef M::size_type I
;
39 M
m(ar
, ar
+ sizeof(ar
)/sizeof(ar
[0]));
40 assert(m
.size() == 9);
42 assert(m
.size() == 9);
44 assert(*std::next(m
.begin(), 0) == 3);
45 assert(*std::next(m
.begin(), 1) == 3);
46 assert(*std::next(m
.begin(), 2) == 3);
47 assert(*std::next(m
.begin(), 3) == 5);
48 assert(*std::next(m
.begin(), 4) == 5);
49 assert(*std::next(m
.begin(), 5) == 5);
50 assert(*std::next(m
.begin(), 6) == 7);
51 assert(*std::next(m
.begin(), 7) == 7);
52 assert(*std::next(m
.begin(), 8) == 7);
55 assert(m
.size() == 6);
57 assert(*std::next(m
.begin(), 0) == 3);
58 assert(*std::next(m
.begin(), 1) == 3);
59 assert(*std::next(m
.begin(), 2) == 3);
60 assert(*std::next(m
.begin(), 3) == 7);
61 assert(*std::next(m
.begin(), 4) == 7);
62 assert(*std::next(m
.begin(), 5) == 7);
65 assert(m
.size() == 3);
67 assert(*std::next(m
.begin(), 0) == 7);
68 assert(*std::next(m
.begin(), 1) == 7);
69 assert(*std::next(m
.begin(), 2) == 7);
72 assert(m
.size() == 0);
75 #if TEST_STD_VER >= 11
77 typedef std::multiset
<int, std::less
<int>, min_allocator
<int>> M
;
79 typedef M::size_type I
;
92 M
m(ar
, ar
+ sizeof(ar
)/sizeof(ar
[0]));
93 assert(m
.size() == 9);
95 assert(m
.size() == 9);
97 assert(*std::next(m
.begin(), 0) == 3);
98 assert(*std::next(m
.begin(), 1) == 3);
99 assert(*std::next(m
.begin(), 2) == 3);
100 assert(*std::next(m
.begin(), 3) == 5);
101 assert(*std::next(m
.begin(), 4) == 5);
102 assert(*std::next(m
.begin(), 5) == 5);
103 assert(*std::next(m
.begin(), 6) == 7);
104 assert(*std::next(m
.begin(), 7) == 7);
105 assert(*std::next(m
.begin(), 8) == 7);
108 assert(m
.size() == 6);
110 assert(*std::next(m
.begin(), 0) == 3);
111 assert(*std::next(m
.begin(), 1) == 3);
112 assert(*std::next(m
.begin(), 2) == 3);
113 assert(*std::next(m
.begin(), 3) == 7);
114 assert(*std::next(m
.begin(), 4) == 7);
115 assert(*std::next(m
.begin(), 5) == 7);
118 assert(m
.size() == 3);
120 assert(*std::next(m
.begin(), 0) == 7);
121 assert(*std::next(m
.begin(), 1) == 7);
122 assert(*std::next(m
.begin(), 2) == 7);
125 assert(m
.size() == 0);