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 |
10 | |
11 | // <memory> |
12 | |
13 | // template <class OuterAlloc, class... InnerAllocs> |
14 | // class scoped_allocator_adaptor |
15 | |
16 | // inner_allocator_type& inner_allocator(); |
17 | // const inner_allocator_type& inner_allocator() const; |
18 | |
19 | #include <scoped_allocator> |
20 | #include <cassert> |
21 | |
22 | #include "test_macros.h" |
23 | #include "allocators.h" |
24 | |
25 | int main(int, char**) { |
26 | { |
27 | typedef std::scoped_allocator_adaptor<A1<int>> A; |
28 | A a(A1<int>(5)); |
29 | assert(a.inner_allocator() == a); |
30 | } |
31 | { |
32 | typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A; |
33 | A a(A1<int>(5), A2<int>(6)); |
34 | assert(a.inner_allocator() == std::scoped_allocator_adaptor<A2<int>>(A2<int>(6))); |
35 | } |
36 | { |
37 | typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A; |
38 | A a(A1<int>(5), A2<int>(6), A3<int>(8)); |
39 | assert((a.inner_allocator() == std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(6), A3<int>(8)))); |
40 | } |
41 | |
42 | return 0; |
43 | } |
44 | |