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 // <set>
10
11 // class multiset
12
13 // void clear() noexcept;
14
15 #include <set>
16 #include <cassert>
17
18 #include "test_macros.h"
19 #include "min_allocator.h"
20
main(int,char **)21 int main(int, char**)
22 {
23 {
24 typedef std::multiset<int> M;
25 typedef int V;
26 V ar[] =
27 {
28 1,
29 2,
30 3,
31 4,
32 5,
33 6,
34 7,
35 8
36 };
37 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
38 assert(m.size() == 8);
39 ASSERT_NOEXCEPT(m.clear());
40 m.clear();
41 assert(m.size() == 0);
42 }
43 #if TEST_STD_VER >= 11
44 {
45 typedef std::multiset<int, std::less<int>, min_allocator<int>> M;
46 typedef int V;
47 V ar[] =
48 {
49 1,
50 2,
51 3,
52 4,
53 5,
54 6,
55 7,
56 8
57 };
58 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
59 assert(m.size() == 8);
60 ASSERT_NOEXCEPT(m.clear());
61 m.clear();
62 assert(m.size() == 0);
63 }
64 #endif
65
66 return 0;
67 }
68