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 // <map> 11 12 // class multimap 13 14 // void clear(); 15 16 #include <map> 17 #include <cassert> 18 19 #include "min_allocator.h" 20 21 int main() 22 { 23 { 24 typedef std::multimap<int, double> M; 25 typedef std::pair<int, double> P; 26 P ar[] = 27 { 28 P(1, 1.5), 29 P(2, 2.5), 30 P(3, 3.5), 31 P(4, 4.5), 32 P(5, 5.5), 33 P(6, 6.5), 34 P(7, 7.5), 35 P(8, 8.5), 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::multimap<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M; 45 typedef std::pair<int, double> P; 46 P ar[] = 47 { 48 P(1, 1.5), 49 P(2, 2.5), 50 P(3, 3.5), 51 P(4, 4.5), 52 P(5, 5.5), 53 P(6, 6.5), 54 P(7, 7.5), 55 P(8, 8.5), 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