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 // <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 // iterator insert(const value_type& x);
     17 
     18 #include <unordered_set>
     19 #include <cassert>
     20 
     21 #include "min_allocator.h"
     22 
     23 int main()
     24 {
     25     {
     26         typedef std::unordered_multiset<double> C;
     27         typedef C::iterator R;
     28         typedef C::value_type P;
     29         C c;
     30         R r = c.insert(P(3.5));
     31         assert(c.size() == 1);
     32         assert(*r == 3.5);
     33 
     34         r = c.insert(P(3.5));
     35         assert(c.size() == 2);
     36         assert(*r == 3.5);
     37 
     38         r = c.insert(P(4.5));
     39         assert(c.size() == 3);
     40         assert(*r == 4.5);
     41 
     42         r = c.insert(P(5.5));
     43         assert(c.size() == 4);
     44         assert(*r == 5.5);
     45     }
     46 #if __cplusplus >= 201103L
     47     {
     48         typedef std::unordered_multiset<double, std::hash<double>,
     49                                 std::equal_to<double>, min_allocator<double>> C;
     50         typedef C::iterator R;
     51         typedef C::value_type P;
     52         C c;
     53         R r = c.insert(P(3.5));
     54         assert(c.size() == 1);
     55         assert(*r == 3.5);
     56 
     57         r = c.insert(P(3.5));
     58         assert(c.size() == 2);
     59         assert(*r == 3.5);
     60 
     61         r = c.insert(P(4.5));
     62         assert(c.size() == 3);
     63         assert(*r == 4.5);
     64 
     65         r = c.insert(P(5.5));
     66         assert(c.size() == 4);
     67         assert(*r == 5.5);
     68     }
     69 #endif
     70 }
     71