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 | // : public OuterAlloc |
| 15 | // { |
| 16 | // public: |
| 17 | // typedef OuterAlloc outer_allocator_type; |
| 18 | // typedef typename OuterTraits::size_type size_type; |
| 19 | // typedef typename OuterTraits::difference_type difference_type; |
| 20 | // typedef typename OuterTraits::pointer pointer; |
| 21 | // typedef typename OuterTraits::const_pointer const_pointer; |
| 22 | // typedef typename OuterTraits::void_pointer void_pointer; |
| 23 | // typedef typename OuterTraits::const_void_pointer const_void_pointer; |
| 24 | // }; |
| 25 | |
Howard Hinnant | e92c3d7 | 2010-08-19 18:39:17 +0000 | [diff] [blame] | 26 | #include <scoped_allocator> |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 27 | #include <type_traits> |
| 28 | |
| 29 | #include "allocators.h" |
| 30 | |
| 31 | int main() |
| 32 | { |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 33 | #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 34 | |
| 35 | static_assert((std::is_base_of< |
| 36 | A1<int>, |
| 37 | std::scoped_allocator_adaptor<A1<int>> |
| 38 | >::value), ""); |
| 39 | |
| 40 | static_assert((std::is_same< |
| 41 | std::scoped_allocator_adaptor<A1<int>>::outer_allocator_type, |
| 42 | A1<int>>::value), ""); |
| 43 | |
| 44 | static_assert((std::is_same< |
| 45 | std::scoped_allocator_adaptor<A1<int>>::size_type, |
| 46 | std::size_t>::value), ""); |
| 47 | |
| 48 | static_assert((std::is_same< |
| 49 | std::scoped_allocator_adaptor<A1<int>>::difference_type, |
| 50 | std::ptrdiff_t>::value), ""); |
| 51 | |
| 52 | static_assert((std::is_same< |
| 53 | std::scoped_allocator_adaptor<A1<int>>::pointer, |
| 54 | int*>::value), ""); |
| 55 | |
| 56 | static_assert((std::is_same< |
| 57 | std::scoped_allocator_adaptor<A1<int>>::const_pointer, |
| 58 | const int*>::value), ""); |
| 59 | |
| 60 | static_assert((std::is_same< |
| 61 | std::scoped_allocator_adaptor<A1<int>>::void_pointer, |
| 62 | void*>::value), ""); |
| 63 | |
| 64 | static_assert((std::is_same< |
| 65 | std::scoped_allocator_adaptor<A1<int>>::const_void_pointer, |
| 66 | const void*>::value), ""); |
| 67 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 68 | static_assert((std::is_base_of< |
| 69 | A2<int>, |
| 70 | std::scoped_allocator_adaptor<A2<int>, A1<int>> |
| 71 | >::value), ""); |
| 72 | |
| 73 | static_assert((std::is_same< |
| 74 | std::scoped_allocator_adaptor<A2<int>, A1<int>>::outer_allocator_type, |
| 75 | A2<int>>::value), ""); |
| 76 | |
| 77 | static_assert((std::is_same< |
| 78 | std::scoped_allocator_adaptor<A2<int>, A1<int>>::size_type, |
| 79 | unsigned>::value), ""); |
| 80 | |
| 81 | static_assert((std::is_same< |
| 82 | std::scoped_allocator_adaptor<A2<int>, A1<int>>::difference_type, |
| 83 | int>::value), ""); |
| 84 | |
| 85 | static_assert((std::is_same< |
| 86 | std::scoped_allocator_adaptor<A2<int>, A1<int>>::pointer, |
| 87 | int*>::value), ""); |
| 88 | |
| 89 | static_assert((std::is_same< |
| 90 | std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_pointer, |
| 91 | const int*>::value), ""); |
| 92 | |
| 93 | static_assert((std::is_same< |
| 94 | std::scoped_allocator_adaptor<A2<int>, A1<int>>::void_pointer, |
| 95 | void*>::value), ""); |
| 96 | |
| 97 | static_assert((std::is_same< |
| 98 | std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_void_pointer, |
| 99 | const void*>::value), ""); |
| 100 | |
Howard Hinnant | 73d21a4 | 2010-09-04 23:28:19 +0000 | [diff] [blame^] | 101 | #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 102 | } |