30#ifndef _USES_ALLOCATOR_ARGS
31#define _USES_ALLOCATOR_ARGS 1
33#pragma GCC system_header
37#ifdef __glibcxx_make_obj_using_allocator
43namespace std _GLIBCXX_VISIBILITY(default)
45_GLIBCXX_BEGIN_NAMESPACE_VERSION
47 template<
typename _Tp>
48 concept _Std_pair = __is_pair<remove_cv_t<_Tp>>;
53 template<
typename _Tp,
typename _Alloc,
typename... _Args>
55 uses_allocator_construction_args(
const _Alloc& __a,
56 _Args&&... __args)
noexcept
57 requires (! _Std_pair<_Tp>)
59 if constexpr (uses_allocator_v<remove_cv_t<_Tp>, _Alloc>)
61 if constexpr (is_constructible_v<_Tp, allocator_arg_t,
62 const _Alloc&, _Args...>)
64 return tuple<allocator_arg_t,
const _Alloc&, _Args&&...>(
69 static_assert(is_constructible_v<_Tp, _Args...,
const _Alloc&>,
70 "construction with an allocator must be possible"
71 " if uses_allocator is true");
73 return tuple<_Args&&...,
const _Alloc&>(
79 static_assert(is_constructible_v<_Tp, _Args...>);
85 template<_Std_pair _Tp,
typename _Alloc,
typename _Tuple1,
typename _Tuple2>
87 uses_allocator_construction_args(
const _Alloc& __a, piecewise_construct_t,
88 _Tuple1&& __x, _Tuple2&& __y)
noexcept;
90 template<_Std_pair _Tp,
typename _Alloc>
92 uses_allocator_construction_args(
const _Alloc&)
noexcept;
94 template<_Std_pair _Tp,
typename _Alloc,
typename _Up,
typename _Vp>
96 uses_allocator_construction_args(
const _Alloc&, _Up&&, _Vp&&) noexcept;
98 template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp>
100 uses_allocator_construction_args(const _Alloc&,
101 const pair<_Up, _Vp>&) noexcept;
103 template<_Std_pair _Tp, typename _Alloc, typename _Up, typename _Vp>
105 uses_allocator_construction_args(const _Alloc&, pair<_Up, _Vp>&&) noexcept;
107#if __cplusplus > 202002L
108 template<_Std_pair _Tp,
typename _Alloc,
typename _Up,
typename _Vp>
110 uses_allocator_construction_args(
const _Alloc&,
111 pair<_Up, _Vp>&)
noexcept;
113 template<_Std_pair _Tp,
typename _Alloc,
typename _Up,
typename _Vp>
115 uses_allocator_construction_args(
const _Alloc&,
const pair<_Up, _Vp>&&) noexcept;
118 template<_Std_pair _Tp,
typename _Alloc,
typename _Tuple1,
typename _Tuple2>
120 uses_allocator_construction_args(
const _Alloc& __a, piecewise_construct_t,
121 _Tuple1&& __x, _Tuple2&& __y)
noexcept
123 using _Tp1 =
typename _Tp::first_type;
124 using _Tp2 =
typename _Tp::second_type;
127 std::apply([&__a](
auto&&... __args1) {
131 std::apply([&__a](
auto&&... __args2) {
137 template<_Std_pair _Tp,
typename _Alloc>
139 uses_allocator_construction_args(
const _Alloc& __a)
noexcept
141 using _Tp1 =
typename _Tp::first_type;
142 using _Tp2 =
typename _Tp::second_type;
149 template<_Std_pair _Tp,
typename _Alloc,
typename _Up,
typename _Vp>
151 uses_allocator_construction_args(
const _Alloc& __a, _Up&& __u, _Vp&& __v)
154 using _Tp1 =
typename _Tp::first_type;
155 using _Tp2 =
typename _Tp::second_type;
164 template<_Std_pair _Tp,
typename _Alloc,
typename _Up,
typename _Vp>
166 uses_allocator_construction_args(
const _Alloc& __a,
167 const pair<_Up, _Vp>& __pr)
noexcept
169 using _Tp1 =
typename _Tp::first_type;
170 using _Tp2 =
typename _Tp::second_type;
177 template<_Std_pair _Tp,
typename _Alloc,
typename _Up,
typename _Vp>
179 uses_allocator_construction_args(
const _Alloc& __a,
180 pair<_Up, _Vp>&& __pr)
noexcept
182 using _Tp1 =
typename _Tp::first_type;
183 using _Tp2 =
typename _Tp::second_type;
195#if __cplusplus > 202002L
196 template<_Std_pair _Tp,
typename _Alloc,
typename _Up,
typename _Vp>
198 uses_allocator_construction_args(
const _Alloc& __a,
199 pair<_Up, _Vp>& __pr)
noexcept
201 using _Tp1 =
typename _Tp::first_type;
202 using _Tp2 =
typename _Tp::second_type;
209 template<_Std_pair _Tp,
typename _Alloc,
typename _Up,
typename _Vp>
211 uses_allocator_construction_args(
const _Alloc& __a,
212 const pair<_Up, _Vp>&& __pr)
noexcept
214 using _Tp1 =
typename _Tp::first_type;
215 using _Tp2 =
typename _Tp::second_type;
225 template<
typename _Tp,
typename _Alloc,
typename... _Args>
227 make_obj_using_allocator(
const _Alloc& __a, _Args&&... __args)
234 template<
typename _Tp,
typename _Alloc,
typename... _Args>
236 uninitialized_construct_using_allocator(_Tp* __p,
const _Alloc& __a,
239 return std::apply([&](
auto&&... __xs) {
240 return std::construct_at(__p,
std::forward<
decltype(__xs)>(__xs)...);
245_GLIBCXX_END_NAMESPACE_VERSION
constexpr tuple< typename __decay_and_strip< _Elements >::__type... > make_tuple(_Elements &&... __args)
Create a tuple containing copies of the arguments.
constexpr std::remove_reference< _Tp >::type && move(_Tp &&__t) noexcept
Convert a value to an rvalue.
constexpr piecewise_construct_t piecewise_construct
Tag for piecewise construction of std::pair objects.
constexpr _Tp && forward(typename std::remove_reference< _Tp >::type &__t) noexcept
Forward an lvalue.
ISO C++ entities toplevel namespace is std.