Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / experimental / memory / memory.resource.aliases / header_map_synop.pass.cpp
blobb59b7f14412b68846acc195b97781a1bbcd0d74f
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 // UNSUPPORTED: c++03
11 // XFAIL: availability-aligned_allocation-missing
13 // <experimental/map>
15 // namespace std { namespace experimental { namespace pmr {
16 // template <class K, class V, class Compare = less<Key> >
17 // using map =
18 // ::std::map<K, V, Compare, polymorphic_allocator<pair<const K, V>>>
20 // template <class K, class V, class Compare = less<Key> >
21 // using multimap =
22 // ::std::multimap<K, V, Compare, polymorphic_allocator<pair<const K, V>>>
24 // }}} // namespace std::experimental::pmr
26 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
28 #include <experimental/map>
29 #include <experimental/memory_resource>
30 #include <type_traits>
31 #include <cassert>
33 #include "test_macros.h"
35 namespace pmr = std::experimental::pmr;
37 int main(int, char**)
39 using K = int;
40 using V = char;
41 using DC = std::less<int>;
42 using OC = std::greater<int>;
43 using P = std::pair<const K, V>;
45 using StdMap = std::map<K, V, DC, pmr::polymorphic_allocator<P>>;
46 using PmrMap = pmr::map<K, V>;
47 static_assert(std::is_same<StdMap, PmrMap>::value, "");
50 using StdMap = std::map<K, V, OC, pmr::polymorphic_allocator<P>>;
51 using PmrMap = pmr::map<K, V, OC>;
52 static_assert(std::is_same<StdMap, PmrMap>::value, "");
55 pmr::map<int, int> m;
56 assert(m.get_allocator().resource() == pmr::get_default_resource());
59 using StdMap = std::multimap<K, V, DC, pmr::polymorphic_allocator<P>>;
60 using PmrMap = pmr::multimap<K, V>;
61 static_assert(std::is_same<StdMap, PmrMap>::value, "");
64 using StdMap = std::multimap<K, V, OC, pmr::polymorphic_allocator<P>>;
65 using PmrMap = pmr::multimap<K, V, OC>;
66 static_assert(std::is_same<StdMap, PmrMap>::value, "");
69 pmr::multimap<int, int> m;
70 assert(m.get_allocator().resource() == pmr::get_default_resource());
73 return 0;