1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
11 // template <class Alloc>
12 // struct allocator_traits
14 // template <class T> using rebind_traits = allocator_traits<rebind_alloc<T>>;
19 #include <type_traits>
21 #include "test_macros.h"
31 template <class U
> struct rebind
{typedef ReboundA
<U
> other
;};
34 template <class T
, class U
>
37 template <class T
, class U
>
42 template <class V
> struct rebind
{typedef ReboundB
<V
, U
> other
;};
51 template <class T
, class U
>
62 template <class U
> struct rebind
{typedef ReboundA
<U
> otter
;};
67 #if TEST_STD_VER >= 11
68 static_assert((std::is_same
<std::allocator_traits
<A
<char> >::rebind_traits
<double>, std::allocator_traits
<ReboundA
<double> > >::value
), "");
69 static_assert((std::is_same
<std::allocator_traits
<B
<int, char> >::rebind_traits
<double>, std::allocator_traits
<ReboundB
<double, char> > >::value
), "");
70 static_assert((std::is_same
<std::allocator_traits
<C
<char> >::rebind_traits
<double>, std::allocator_traits
<C
<double> > >::value
), "");
71 static_assert((std::is_same
<std::allocator_traits
<D
<int, char> >::rebind_traits
<double>, std::allocator_traits
<D
<double, char> > >::value
), "");
72 static_assert((std::is_same
<std::allocator_traits
<E
<char> >::rebind_traits
<double>, std::allocator_traits
<E
<double> > >::value
), "");
74 static_assert((std::is_same
<std::allocator_traits
<A
<char> >::rebind_traits
<double>::other
, std::allocator_traits
<ReboundA
<double> > >::value
), "");
75 static_assert((std::is_same
<std::allocator_traits
<B
<int, char> >::rebind_traits
<double>::other
, std::allocator_traits
<ReboundB
<double, char> > >::value
), "");
76 static_assert((std::is_same
<std::allocator_traits
<C
<char> >::rebind_traits
<double>::other
, std::allocator_traits
<C
<double> > >::value
), "");
77 static_assert((std::is_same
<std::allocator_traits
<D
<int, char> >::rebind_traits
<double>::other
, std::allocator_traits
<D
<double, char> > >::value
), "");
78 static_assert((std::is_same
<std::allocator_traits
<E
<char> >::rebind_traits
<double>::other
, std::allocator_traits
<E
<double> > >::value
), "");