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 // template <class InputIterator>
14 // multiset(InputIterator first, InputIterator last,
15 // const value_compare& comp, const allocator_type& a);
20 #include "test_macros.h"
21 #include "test_iterators.h"
22 #include "../../../test_compare.h"
23 #include "test_allocator.h"
41 typedef test_less
<V
> C
;
42 typedef test_allocator
<V
> A
;
43 std::multiset
<V
, C
, A
> m(cpp17_input_iterator
<const V
*>(ar
),
44 cpp17_input_iterator
<const V
*>(ar
+sizeof(ar
)/sizeof(ar
[0])),
46 assert(m
.value_comp() == C(5));
47 assert(m
.get_allocator() == A(7));
48 assert(m
.size() == 9);
49 assert(std::distance(m
.begin(), m
.end()) == 9);
50 assert(*std::next(m
.begin(), 0) == 1);
51 assert(*std::next(m
.begin(), 1) == 1);
52 assert(*std::next(m
.begin(), 2) == 1);
53 assert(*std::next(m
.begin(), 3) == 2);
54 assert(*std::next(m
.begin(), 4) == 2);
55 assert(*std::next(m
.begin(), 5) == 2);
56 assert(*std::next(m
.begin(), 6) == 3);
57 assert(*std::next(m
.begin(), 7) == 3);
58 assert(*std::next(m
.begin(), 8) == 3);
75 typedef test_allocator
<V
> A
;
76 typedef test_less
<int> C
;
78 std::multiset
<V
, C
, A
> m(ar
, ar
+sizeof(ar
)/sizeof(ar
[0]), a
);
80 assert(m
.size() == 9);
81 assert(std::distance(m
.begin(), m
.end()) == 9);
82 assert(*std::next(m
.begin(), 0) == 1);
83 assert(*std::next(m
.begin(), 1) == 1);
84 assert(*std::next(m
.begin(), 2) == 1);
85 assert(*std::next(m
.begin(), 3) == 2);
86 assert(*std::next(m
.begin(), 4) == 2);
87 assert(*std::next(m
.begin(), 5) == 2);
88 assert(*std::next(m
.begin(), 6) == 3);
89 assert(*std::next(m
.begin(), 7) == 3);
90 assert(*std::next(m
.begin(), 8) == 3);
91 assert(m
.get_allocator() == a
);