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 swap(unordered_set& x, unordered_set& y); 17 18 #if _LIBCPP_DEBUG >= 1 19 #define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0)) 20 #endif 21 22 #include <unordered_set> 23 #include <cassert> 24 25 int main() 26 { 27 #if _LIBCPP_DEBUG >= 1 28 { 29 int a1[] = {1, 3, 7, 9, 10}; 30 int a2[] = {0, 2, 4, 5, 6, 8, 11}; 31 std::unordered_set<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0])); 32 std::unordered_set<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0])); 33 std::unordered_set<int>::iterator i1 = c1.begin(); 34 std::unordered_set<int>::iterator i2 = c2.begin(); 35 swap(c1, c2); 36 c1.erase(i2); 37 c2.erase(i1); 38 std::unordered_set<int>::iterator j = i1; 39 c1.erase(i1); 40 assert(false); 41 } 42 #endif 43 } 44