|
| 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 | +// : public OuterAlloc |
| 16 | +// { |
| 17 | +// public: |
| 18 | +// typedef OuterAlloc outer_allocator_type; |
| 19 | +// typedef typename OuterTraits::size_type size_type; |
| 20 | +// typedef typename OuterTraits::difference_type difference_type; |
| 21 | +// typedef typename OuterTraits::pointer pointer; |
| 22 | +// typedef typename OuterTraits::const_pointer const_pointer; |
| 23 | +// typedef typename OuterTraits::void_pointer void_pointer; |
| 24 | +// typedef typename OuterTraits::const_void_pointer const_void_pointer; |
| 25 | +// }; |
| 26 | + |
| 27 | +#include <scoped_allocator> |
| 28 | +#include <type_traits> |
| 29 | + |
| 30 | +#include "test_macros.h" |
| 31 | +#include "allocators.h" |
| 32 | + |
| 33 | +static_assert(std::is_base_of<A1<int>, std::scoped_allocator_adaptor<A1<int>> >::value, ""); |
| 34 | + |
| 35 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A1<int>>::outer_allocator_type, A1<int>>::value, ""); |
| 36 | + |
| 37 | +static_assert( |
| 38 | + std::is_same<std::scoped_allocator_adaptor<A1<int>>::size_type, std::make_unsigned<std::ptrdiff_t>::type>::value, |
| 39 | + ""); |
| 40 | + |
| 41 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A1<int>>::difference_type, std::ptrdiff_t>::value, ""); |
| 42 | + |
| 43 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A1<int>>::pointer, int*>::value, ""); |
| 44 | + |
| 45 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A1<int>>::const_pointer, const int*>::value, ""); |
| 46 | + |
| 47 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A1<int>>::void_pointer, void*>::value, ""); |
| 48 | + |
| 49 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A1<int>>::const_void_pointer, const void*>::value, ""); |
| 50 | + |
| 51 | +static_assert(std::is_base_of<A2<int>, std::scoped_allocator_adaptor<A2<int>, A1<int>> >::value, ""); |
| 52 | + |
| 53 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A2<int>, A1<int>>::outer_allocator_type, A2<int>>::value, ""); |
| 54 | + |
| 55 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A2<int>, A1<int>>::size_type, unsigned>::value, ""); |
| 56 | + |
| 57 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A2<int>, A1<int>>::difference_type, int>::value, ""); |
| 58 | + |
| 59 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A2<int>, A1<int>>::pointer, int*>::value, ""); |
| 60 | + |
| 61 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_pointer, const int*>::value, ""); |
| 62 | + |
| 63 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A2<int>, A1<int>>::void_pointer, void*>::value, ""); |
| 64 | + |
| 65 | +static_assert(std::is_same<std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_void_pointer, const void*>::value, |
| 66 | + ""); |
0 commit comments