56 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <map>10 11// class map12 13// map(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 23int main(int, char**) {24 {25 typedef test_less<int> C;26 typedef test_allocator<std::pair<const int, double> > A;27 std::map<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 >= 1134 {35 typedef test_less<int> C;36 typedef min_allocator<std::pair<const int, double> > A;37 std::map<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_less<int> C;45 typedef explicit_allocator<std::pair<const int, double> > A;46 std::map<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#endif53 54 return 0;55}56