xref: /llvm-project/libcxx/test/std/containers/associative/multimap/multimap.cons/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 // explicit multimap(const allocator_type& a);
14 
15 #include <map>
16 #include <cassert>
17 
18 #include "test_allocator.h"
19 #include "min_allocator.h"
20 
21 int main()
22 {
23     {
24     typedef std::less<int> C;
25     typedef test_allocator<std::pair<const int, double> > A;
26     std::multimap<int, double, C, A> m(A(5));
27     assert(m.empty());
28     assert(m.begin() == m.end());
29     assert(m.get_allocator() == A(5));
30     }
31 #if TEST_STD_VER >= 11
32     {
33     typedef std::less<int> C;
34     typedef min_allocator<std::pair<const int, double> > A;
35     std::multimap<int, double, C, A> m(A{});
36     assert(m.empty());
37     assert(m.begin() == m.end());
38     assert(m.get_allocator() == A());
39     }
40     {
41     typedef std::less<int> C;
42     typedef explicit_allocator<std::pair<const int, double> > A;
43     std::multimap<int, double, C, A> m(A{});
44     assert(m.empty());
45     assert(m.begin() == m.end());
46     assert(m.get_allocator() == A{});
47     }
48 #endif
49 }
50