| 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 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03, c++11, c++14 |
| 10 | // TODO: Change to XFAIL once https://github.com/llvm/llvm-project/issues/40340 is fixed |
| 11 | // UNSUPPORTED: availability-pmr-missing |
| 12 | |
| 13 | // <vector> |
| 14 | |
| 15 | // namespace std::pmr { |
| 16 | // template <class T> |
| 17 | // using vector = |
| 18 | // ::std::vector<T, polymorphic_allocator<T>> |
| 19 | // |
| 20 | // } // namespace std::pmr |
| 21 | |
| 22 | #include <vector> |
| 23 | #include <memory_resource> |
| 24 | #include <type_traits> |
| 25 | #include <cassert> |
| 26 | |
| 27 | int main(int, char**) { |
| 28 | using StdVector = std::vector<int, std::pmr::polymorphic_allocator<int>>; |
| 29 | using PmrVector = std::pmr::vector<int>; |
| 30 | static_assert(std::is_same<StdVector, PmrVector>::value, ""); |
| 31 | PmrVector d; |
| 32 | assert(d.get_allocator().resource() == std::pmr::get_default_resource()); |
| 33 | |
| 34 | return 0; |
| 35 | } |
| 36 |
