Skip to content

Commit 4406a7a

Browse files
burblebeetkoeppe
authored andcommitted
LWG3821 uses_allocator_construction_args should have overload for pair-like
The new overload is also marked as "freestanding", which was not part of the proposed issue resolution but matches the surrounding interface. Also inserts an Oxford comma in [pair.pair].
1 parent c01e69f commit 4406a7a

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

source/memory.tex

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@
141141
template<class T, class Alloc, class U, class V>
142142
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
143143
const pair<U, V>&& pr) noexcept;
144+
template<class T, class Alloc, @\exposconcept{pair-like}@ P>
145+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
146+
P&& p) noexcept;
144147
template<class T, class Alloc, class U>
145148
constexpr auto uses_allocator_construction_args(const Alloc& alloc, // freestanding
146149
U&& u) noexcept;
@@ -1202,6 +1205,28 @@
12021205
\end{codeblock}
12031206
\end{itemdescr}
12041207

1208+
\indexlibraryglobal{uses_allocator_construction_args}%
1209+
\begin{itemdecl}
1210+
template<class T, class Alloc, @\exposconcept{pair-like}@ P>
1211+
constexpr auto uses_allocator_construction_args(const Alloc& alloc, P&& p) noexcept;
1212+
\end{itemdecl}
1213+
1214+
\begin{itemdescr}
1215+
\pnum
1216+
\constraints
1217+
\tcode{remove_cv_t<T>} is a specialization of \tcode{pair} and
1218+
\tcode{remove_cvref_t<P>} is not a specialization of \tcode{ranges::subrange}.
1219+
1220+
\pnum
1221+
\effects
1222+
Equivalent to:
1223+
\begin{codeblock}
1224+
return uses_allocator_construction_args<T>(alloc, piecewise_construct,
1225+
forward_as_tuple(get<0>(std::forward<P>(p))),
1226+
forward_as_tuple(get<1>(std::forward<P>(p))));
1227+
\end{codeblock}
1228+
\end{itemdescr}
1229+
12051230
\indexlibraryglobal{uses_allocator_construction_args}%
12061231
\begin{itemdecl}
12071232
template<class T, class Alloc, class U>
@@ -1218,9 +1243,15 @@
12181243

12191244
\pnum
12201245
\constraints
1221-
\tcode{remove_cv_t<T>} is a specialization of \tcode{pair}, and
1246+
\tcode{remove_cv_t<T>} is a specialization of \tcode{pair}, and either:
1247+
\begin{itemize}
1248+
\item
1249+
\tcode{remove_cvref_t<U>} is a specialization of \tcode{ranges::subrange}, or
1250+
\item
1251+
\tcode{U} does not satisfy \exposconcept{pair-like} and
12221252
the expression \tcode{\exposid{FUN}(u)} is not well-formed
12231253
when considered as an unevaluated operand.
1254+
\end{itemize}
12241255

12251256
\pnum
12261257
Let \exposid{pair-constructor} be an exposition-only class defined as follows:

source/utilities.tex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,11 @@
899899
\constraints
900900
\begin{itemize}
901901
\item
902+
For the last overload,
903+
\tcode{remove_cvref_t<P>} is not a specialization of \tcode{ranges::subrange},
904+
\item
902905
\tcode{is_constructible_v<T1, decltype(get<0>(\exposid{FWD}(p)))>}
903-
is \tcode{true} and
906+
is \tcode{true}, and
904907
\item
905908
\tcode{is_constructible_v<T2, decltype(get<1>(\exposid{FWD}(p)))>}
906909
is \tcode{true}.

0 commit comments

Comments
 (0)