Home | History | Annotate | Download | only in unord.multiset
      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 // template <class... Args>
     19 //     iterator emplace(Args&&... args);
     20 
     21 #include <unordered_set>
     22 #include <cassert>
     23 
     24 #include "../../Emplaceable.h"
     25 #include "min_allocator.h"
     26 
     27 int main()
     28 {
     29     {
     30         typedef std::unordered_multiset<Emplaceable> C;
     31         typedef C::iterator R;
     32         C c;
     33         R r = c.emplace();
     34         assert(c.size() == 1);
     35         assert(*r == Emplaceable());
     36 
     37         r = c.emplace(Emplaceable(5, 6));
     38         assert(c.size() == 2);
     39         assert(*r == Emplaceable(5, 6));
     40 
     41         r = c.emplace(5, 6);
     42         assert(c.size() == 3);
     43         assert(*r == Emplaceable(5, 6));
     44     }
     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 }
     63