Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | // <memory> |
| 11 | |
| 12 | // template <class OuterAlloc, class... InnerAllocs> |
| 13 | // class scoped_allocator_adaptor |
| 14 | |
| 15 | // inner_allocator_type& inner_allocator(); |
| 16 | // const inner_allocator_type& inner_allocator() const; |
| 17 | |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 18 | #include <scoped_allocator> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 19 | #include <cassert> |
| 20 | |
| 21 | #include "../allocators.h" |
| 22 | |
| 23 | int main() |
| 24 | { |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 25 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 26 | |
| 27 | { |
| 28 | typedef std::scoped_allocator_adaptor<A1<int>> A; |
| 29 | A a(A1<int>(5)); |
| 30 | assert(a.inner_allocator() == a); |
| 31 | } |
| 32 | { |
| 33 | typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A; |
| 34 | A a(A1<int>(5), A2<int>(6)); |
| 35 | assert(a.inner_allocator() == std::scoped_allocator_adaptor<A2<int>>(A2<int>(6))); |
| 36 | } |
| 37 | { |
| 38 | typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A; |
| 39 | A a(A1<int>(5), A2<int>(6), A3<int>(8)); |
| 40 | assert((a.inner_allocator() == |
| 41 | std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(6), A3<int>(8)))); |
| 42 | } |
| 43 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 44 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 45 | } |