xref: /llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/compare_alloc.pass.cpp (revision 57b08b0944046a6a57ee9b7b479181f548a5b9b4)
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_compare.h"
19 #include "test_allocator.h"
20 #include "min_allocator.h"
21 
22 int main()
23 {
24     {
25     typedef test_compare<std::less<int> > C;
26     typedef test_allocator<std::pair<const int, double> > A;
27     std::multimap<int, double, C, A> m(C(4), A(5));
28     assert(m.empty());
29     assert(m.begin() == m.end());
30     assert(m.key_comp() == C(4));
31     assert(m.get_allocator() == A(5));
32     }
33 #if TEST_STD_VER >= 11
34     {
35     typedef test_compare<std::less<int> > C;
36     typedef min_allocator<std::pair<const int, double> > A;
37     std::multimap<int, double, C, A> m(C(4), A());
38     assert(m.empty());
39     assert(m.begin() == m.end());
40     assert(m.key_comp() == C(4));
41     assert(m.get_allocator() == A());
42     }
43     {
44     typedef test_compare<std::less<int> > C;
45     typedef explicit_allocator<std::pair<const int, double> > A;
46     std::multimap<int, double, C, A> m(C(4), A{});
47     assert(m.empty());
48     assert(m.begin() == m.end());
49     assert(m.key_comp() == C(4));
50     assert(m.get_allocator() == A{});
51     }
52 #endif
53 }
54