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 //===----------------------------------------------------------------------===//
11 // XFAIL: availability-aligned_allocation-missing
15 // namespace std { namespace experimental { namespace pmr {
16 // template <class V, class Compare = less<V> >
18 // ::std::set<V, Compare, polymorphic_allocator<V>>
20 // template <class V, class Compare = less<V> >
22 // ::std::multiset<V, Compare, polymorphic_allocator<V>>
24 // }}} // namespace std::experimental::pmr
26 // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS
28 #include <experimental/set>
29 #include <experimental/memory_resource>
30 #include <type_traits>
33 #include "test_macros.h"
35 namespace pmr
= std::experimental::pmr
;
40 using DC
= std::less
<V
>;
41 using OC
= std::greater
<V
>;
43 using StdSet
= std::set
<V
, DC
, pmr::polymorphic_allocator
<V
>>;
44 using PmrSet
= pmr::set
<V
>;
45 static_assert(std::is_same
<StdSet
, PmrSet
>::value
, "");
48 using StdSet
= std::set
<V
, OC
, pmr::polymorphic_allocator
<V
>>;
49 using PmrSet
= pmr::set
<V
, OC
>;
50 static_assert(std::is_same
<StdSet
, PmrSet
>::value
, "");
54 assert(m
.get_allocator().resource() == pmr::get_default_resource());
57 using StdSet
= std::multiset
<V
, DC
, pmr::polymorphic_allocator
<V
>>;
58 using PmrSet
= pmr::multiset
<V
>;
59 static_assert(std::is_same
<StdSet
, PmrSet
>::value
, "");
62 using StdSet
= std::multiset
<V
, OC
, pmr::polymorphic_allocator
<V
>>;
63 using PmrSet
= pmr::multiset
<V
, OC
>;
64 static_assert(std::is_same
<StdSet
, PmrSet
>::value
, "");
68 assert(m
.get_allocator().resource() == pmr::get_default_resource());