libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

compare.pass.cpp (1030B)


      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 // explicit map(const key_compare& comp);
     15 
     16 // key_compare key_comp() const;
     17 
     18 #include <map>
     19 #include <cassert>
     20 
     21 #include "../../../test_compare.h"
     22 #include "min_allocator.h"
     23 
     24 int main()
     25 {
     26     {
     27     typedef test_compare<std::less<int> > C;
     28     const std::map<int, double, C> m(C(3));
     29     assert(m.empty());
     30     assert(m.begin() == m.end());
     31     assert(m.key_comp() == C(3));
     32     }
     33 #if TEST_STD_VER >= 11
     34     {
     35     typedef test_compare<std::less<int> > C;
     36     const std::map<int, double, C, min_allocator<std::pair<const int, double>>> m(C(3));
     37     assert(m.empty());
     38     assert(m.begin() == m.end());
     39     assert(m.key_comp() == C(3));
     40     }
     41 #endif
     42 }