insert_init.pass.cpp (1861B)
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 // UNSUPPORTED: c++98, c++03 11 12 // <unordered_set> 13 14 // template <class Value, class Hash = hash<Value>, class Pred = equal_to<Value>, 15 // class Alloc = allocator<Value>> 16 // class unordered_multiset 17 18 // void insert(initializer_list<value_type> il); 19 20 #include <unordered_set> 21 #include <cassert> 22 23 #include "test_iterators.h" 24 #include "min_allocator.h" 25 26 int main() 27 { 28 { 29 typedef std::unordered_multiset<int> C; 30 typedef int P; 31 C c; 32 c.insert( 33 { 34 P(1), 35 P(2), 36 P(3), 37 P(4), 38 P(1), 39 P(2) 40 } 41 ); 42 assert(c.size() == 6); 43 assert(c.count(1) == 2); 44 assert(c.count(2) == 2); 45 assert(c.count(3) == 1); 46 assert(c.count(4) == 1); 47 } 48 { 49 typedef std::unordered_multiset<int, std::hash<int>, 50 std::equal_to<int>, min_allocator<int>> C; 51 typedef int P; 52 C c; 53 c.insert( 54 { 55 P(1), 56 P(2), 57 P(3), 58 P(4), 59 P(1), 60 P(2) 61 } 62 ); 63 assert(c.size() == 6); 64 assert(c.count(1) == 2); 65 assert(c.count(2) == 2); 66 assert(c.count(3) == 1); 67 assert(c.count(4) == 1); 68 } 69 }