1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
13 // size_type size() const;
18 #include "test_macros.h"
19 #include "min_allocator.h"
24 typedef std::map
<int, double> M
;
26 assert(m
.size() == 0);
27 m
.insert(M::value_type(2, 1.5));
28 assert(m
.size() == 1);
29 m
.insert(M::value_type(1, 1.5));
30 assert(m
.size() == 2);
31 m
.insert(M::value_type(3, 1.5));
32 assert(m
.size() == 3);
34 assert(m
.size() == 2);
36 assert(m
.size() == 1);
38 assert(m
.size() == 0);
40 #if TEST_STD_VER >= 11
42 typedef std::map
<int, double, std::less
<int>, min_allocator
<std::pair
<const int, double>>> M
;
44 assert(m
.size() == 0);
45 m
.insert(M::value_type(2, 1.5));
46 assert(m
.size() == 1);
47 m
.insert(M::value_type(1, 1.5));
48 assert(m
.size() == 2);
49 m
.insert(M::value_type(3, 1.5));
50 assert(m
.size() == 3);
52 assert(m
.size() == 2);
54 assert(m
.size() == 1);
56 assert(m
.size() == 0);