1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <unordered_set>
11 
12 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>,
13 //           class Alloc = allocator<Value>>
14 // class unordered_set
15 
16 // void clear() noexcept;
17 
18 #include <unordered_set>
19 #include <cassert>
20 
21 #include "test_macros.h"
22 #include "min_allocator.h"
23 
main()24 int main()
25 {
26     {
27         typedef std::unordered_set<int> C;
28         typedef int P;
29         P a[] =
30         {
31             P(1),
32             P(2),
33             P(3),
34             P(4),
35             P(1),
36             P(2)
37         };
38         C c(a, a + sizeof(a)/sizeof(a[0]));
39         ASSERT_NOEXCEPT(c.clear());
40         c.clear();
41         assert(c.size() == 0);
42     }
43 #if TEST_STD_VER >= 11
44     {
45         typedef std::unordered_set<int, std::hash<int>, std::equal_to<int>, min_allocator<int>> C;
46         typedef int P;
47         P a[] =
48         {
49             P(1),
50             P(2),
51             P(3),
52             P(4),
53             P(1),
54             P(2)
55         };
56         C c(a, a + sizeof(a)/sizeof(a[0]));
57         ASSERT_NOEXCEPT(c.clear());
58         c.clear();
59         assert(c.size() == 0);
60     }
61 #endif
62 }
63