Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / containers / associative / map / map.modifiers / clear.pass.cpp
blob5c6d00e9f3a8afcf36a06d379aea31171c74d67e
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 //===----------------------------------------------------------------------===//
9 // <map>
11 // class map
13 // void clear() noexcept;
15 #include <map>
16 #include <cassert>
18 #include "test_macros.h"
19 #include "min_allocator.h"
21 int main(int, char**)
24 typedef std::map<int, double> M;
25 typedef std::pair<int, double> P;
26 P ar[] =
28 P(1, 1.5),
29 P(2, 2.5),
30 P(3, 3.5),
31 P(4, 4.5),
32 P(5, 5.5),
33 P(6, 6.5),
34 P(7, 7.5),
35 P(8, 8.5),
37 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
38 assert(m.size() == 8);
39 ASSERT_NOEXCEPT(m.clear());
40 m.clear();
41 assert(m.size() == 0);
43 #if TEST_STD_VER >= 11
45 typedef std::map<int, double, std::less<int>, min_allocator<std::pair<const int, double>>> M;
46 typedef std::pair<int, double> P;
47 P ar[] =
49 P(1, 1.5),
50 P(2, 2.5),
51 P(3, 3.5),
52 P(4, 4.5),
53 P(5, 5.5),
54 P(6, 6.5),
55 P(7, 7.5),
56 P(8, 8.5),
58 M m(ar, ar + sizeof(ar)/sizeof(ar[0]));
59 assert(m.size() == 8);
60 ASSERT_NOEXCEPT(m.clear());
61 m.clear();
62 assert(m.size() == 0);
64 #endif
66 return 0;