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 // <set> 11 12 // class set 13 14 // void clear(); 15 16 #include <set> 17 #include <cassert> 18 19 #include "min_allocator.h" 20 21 int main() 22 { 23 { 24 typedef std::set<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 m.clear(); 40 assert(m.size() == 0); 41 } 42 #if __cplusplus >= 201103L 43 { 44 typedef std::set<int, std::less<int>, min_allocator<int>> M; 45 typedef int V; 46 V ar[] = 47 { 48 1, 49 2, 50 3, 51 4, 52 5, 53 6, 54 7, 55 8 56 }; 57 M m(ar, ar + sizeof(ar)/sizeof(ar[0])); 58 assert(m.size() == 8); 59 m.clear(); 60 assert(m.size() == 0); 61 } 62 #endif 63 } 64