xref: /llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp (revision 5cc55fdb57c989b0987faaae7b667cd3459abae1)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <map>
10 
11 // class multimap
12 
13 // multimap(const key_compare& comp, const allocator_type& a);
14 
15 #include <map>
16 #include <cassert>
17 
18 #include "test_macros.h"
19 #include "../../../test_compare.h"
20 #include "test_allocator.h"
21 #include "min_allocator.h"
22 
main(int,char **)23 int main(int, char**)
24 {
25     {
26     typedef test_less<int> C;
27     typedef test_allocator<std::pair<const int, double> > A;
28     std::multimap<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_less<int> C;
37     typedef min_allocator<std::pair<const int, double> > A;
38     std::multimap<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_less<int> C;
46     typedef explicit_allocator<std::pair<const int, double> > A;
47     std::multimap<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   return 0;
56 }
57