1//===----------------------------------------------------------------------===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9// UNSUPPORTED: c++03
10
11// <set>
12
13// class multiset
14
15// multiset(initializer_list<value_type> il, const key_compare& comp, const allocator_type& a);
16
17#include <set>
18#include <cassert>
19#include <iterator>
20
21#include "test_macros.h"
22#include "../../../test_compare.h"
23#include "test_allocator.h"
24
25int main(int, char**) {
26 typedef test_less<int> Cmp;
27 typedef test_allocator<int> A;
28 typedef std::multiset<int, Cmp, A> C;
29 typedef C::value_type V;
30 C m({1, 2, 3, 4, 5, 6}, Cmp(10), A(4));
31 assert(m.size() == 6);
32 assert(std::distance(m.begin(), m.end()) == 6);
33 C::const_iterator i = m.cbegin();
34 assert(*i == V(1));
35 assert(*++i == V(2));
36 assert(*++i == V(3));
37 assert(*++i == V(4));
38 assert(*++i == V(5));
39 assert(*++i == V(6));
40 assert(m.key_comp() == Cmp(10));
41 assert(m.get_allocator() == A(4));
42
43 return 0;
44}
45

source code of libcxx/test/std/containers/associative/multiset/multiset.cons/initializer_list_compare_alloc.pass.cpp