25 #ifndef _USES_ALLOCATOR_H
26 #define _USES_ALLOCATOR_H 1
28 #if __cplusplus < 201103L
34 namespace std _GLIBCXX_VISIBILITY(default)
36 _GLIBCXX_BEGIN_NAMESPACE_VERSION
43 _GLIBCXX_HAS_NESTED_TYPE(allocator_type)
45 template<typename _Tp, typename _Alloc,
46 bool = __has_allocator_type<_Tp>::value>
47 struct __uses_allocator_helper
50 template<
typename _Tp,
typename _Alloc>
51 struct __uses_allocator_helper<_Tp, _Alloc, true>
52 :
public integral_constant<bool, is_convertible<_Alloc,
53 typename _Tp::allocator_type>::value>
57 template<
typename _Tp,
typename _Alloc>
59 :
public integral_constant<bool,
60 __uses_allocator_helper<_Tp, _Alloc>::value>
63 template<
typename _Tp,
typename _Alloc,
typename... _Args>
64 struct __uses_allocator_arg
65 : is_constructible<_Tp, _Alloc, _Args...>
66 { static_assert( uses_allocator<_Tp, _Alloc>::value,
"uses allocator" ); };
68 struct __uses_alloc_base { };
69 struct __uses_alloc0 : __uses_alloc_base
70 {
struct _Anything { _Anything(...) { } } _M_a; };
71 template<
typename _Alloc>
72 struct __uses_alloc1 : __uses_alloc_base {
const _Alloc* _M_a; };
73 template<
typename _Alloc>
74 struct __uses_alloc2 : __uses_alloc_base {
const _Alloc* _M_a; };
76 template<bool,
typename _Alloc,
typename... _Args>
79 template<
typename _Tp,
typename _Alloc,
typename... _Args>
80 struct __uses_alloc<true, _Tp, _Alloc, _Args...>
82 is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value,
83 __uses_alloc1<_Alloc>,
84 __uses_alloc2<_Alloc>>::type
87 template<
typename _Tp,
typename _Alloc,
typename... _Args>
88 struct __uses_alloc<false, _Tp, _Alloc, _Args...>
91 template<
typename _Tp,
typename _Alloc,
typename... _Args>
92 struct __uses_alloc_impl
93 : __uses_alloc<uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args...>
96 template<
typename _Tp,
typename _Alloc,
typename... _Args>
97 __uses_alloc_impl<_Tp, _Alloc, _Args...>
98 __use_alloc(
const _Alloc& __a)
100 __uses_alloc_impl<_Tp, _Alloc, _Args...> __ret;
105 _GLIBCXX_END_NAMESPACE_VERSION