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_multiset 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 24 int main() 25 { 26 { 27 typedef std::unordered_multiset<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_multiset<int, std::hash<int>, 46 std::equal_to<int>, min_allocator<int>> C; 47 typedef int P; 48 P a[] = 49 { 50 P(1), 51 P(2), 52 P(3), 53 P(4), 54 P(1), 55 P(2) 56 }; 57 C c(a, a + sizeof(a)/sizeof(a[0])); 58 ASSERT_NOEXCEPT(c.clear()); 59 c.clear(); 60 assert(c.size() == 0); 61 } 62 #endif 63 } 64