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 multiset 13 14 // size_type count(const key_type& k) const; 15 16 #include <set> 17 #include <cassert> 18 19 int main() 20 { 21 typedef int V; 22 typedef std::multiset<int> M; 23 { 24 typedef M::size_type R; 25 V ar[] = 26 { 27 5, 28 5, 29 5, 30 5, 31 7, 32 7, 33 7, 34 9, 35 9 36 }; 37 const M m(ar, ar+sizeof(ar)/sizeof(ar[0])); 38 R r = m.count(4); 39 assert(r == 0); 40 r = m.count(5); 41 assert(r == 4); 42 r = m.count(6); 43 assert(r == 0); 44 r = m.count(7); 45 assert(r == 3); 46 r = m.count(8); 47 assert(r == 0); 48 r = m.count(9); 49 assert(r == 2); 50 r = m.count(10); 51 assert(r == 0); 52 } 53 } 54