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_multiset 15 16 // template <class... Args> 17 // iterator emplace(Args&&... args); 18 19 #include <unordered_set> 20 #include <cassert> 21 22 #include "../../Emplaceable.h" 23 #include "min_allocator.h" 24 25 int main() 26 { 27 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 28 { 29 typedef std::unordered_multiset<Emplaceable> C; 30 typedef C::iterator R; 31 C c; 32 R r = c.emplace(); 33 assert(c.size() == 1); 34 assert(*r == Emplaceable()); 35 36 r = c.emplace(Emplaceable(5, 6)); 37 assert(c.size() == 2); 38 assert(*r == Emplaceable(5, 6)); 39 40 r = c.emplace(5, 6); 41 assert(c.size() == 3); 42 assert(*r == Emplaceable(5, 6)); 43 } 44 #if __cplusplus >= 201103L 45 { 46 typedef std::unordered_multiset<Emplaceable, std::hash<Emplaceable>, 47 std::equal_to<Emplaceable>, min_allocator<Emplaceable>> C; 48 typedef C::iterator R; 49 C c; 50 R r = c.emplace(); 51 assert(c.size() == 1); 52 assert(*r == Emplaceable()); 53 54 r = c.emplace(Emplaceable(5, 6)); 55 assert(c.size() == 2); 56 assert(*r == Emplaceable(5, 6)); 57 58 r = c.emplace(5, 6); 59 assert(c.size() == 3); 60 assert(*r == Emplaceable(5, 6)); 61 } 62 #endif 63 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES 64 } 65