Home | History | Annotate | Download | only in map.cons
      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 // <map>
     11 
     12 // class map
     13 
     14 // map(const key_compare& comp, const allocator_type& a);
     15 
     16 #include <map>
     17 #include <cassert>
     18 
     19 #include "../../../test_compare.h"
     20 #include "test_allocator.h"
     21 #include "min_allocator.h"
     22 
     23 int main()
     24 {
     25     {
     26     typedef test_compare<std::less<int> > C;
     27     typedef test_allocator<std::pair<const int, double> > A;
     28     std::map<int, double, C, A> m(C(4), A(5));
     29     assert(m.empty());
     30     assert(m.begin() == m.end());
     31     assert(m.key_comp() == C(4));
     32     assert(m.get_allocator() == A(5));
     33     }
     34 #if TEST_STD_VER >= 11
     35     {
     36     typedef test_compare<std::less<int> > C;
     37     typedef min_allocator<std::pair<const int, double> > A;
     38     std::map<int, double, C, A> m(C(4), A());
     39     assert(m.empty());
     40     assert(m.begin() == m.end());
     41     assert(m.key_comp() == C(4));
     42     assert(m.get_allocator() == A());
     43     }
     44     {
     45     typedef test_compare<std::less<int> > C;
     46     typedef explicit_allocator<std::pair<const int, double> > A;
     47     std::map<int, double, C, A> m(C(4), A{});
     48     assert(m.empty());
     49     assert(m.begin() == m.end());
     50     assert(m.key_comp() == C(4));
     51     assert(m.get_allocator() == A{});
     52     }
     53 #endif
     54 }
     55