Skip to content

Commit f24205d

Browse files
jensmaurerzygoloid
authored andcommitted
P0475R1 LWG2511 Guaranteed copy elision for piecewise construction
1 parent 86b075f commit f24205d

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

source/utilities.tex

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12762,17 +12762,13 @@
1276212762
\end{itemdecl}
1276312763

1276412764
\begin{itemdescr}
12765-
\pnum
12766-
\requires All of the types in \tcode{Args1} and \tcode{Args2} shall be
12767-
\tcode{CopyConstructible} (\tref{copyconstructible}).
12768-
1276912765
\pnum
1277012766
\effects Constructs a \tcode{tuple} object \tcode{xprime} from \tcode{x} by the
1277112767
following rules:
1277212768
\begin{itemize}
1277312769
\item If \tcode{uses_allocator_v<T1, inner_allocator_type>} is \tcode{false} and
1277412770
\tcode{is_constructible_v<T1,\\ Args1...>} is \tcode{true},
12775-
then \tcode{xprime} is \tcode{x}.
12771+
then \tcode{xprime} is \tcode{tuple<Args1\&\&...>(std::move(x))}.
1277612772

1277712773
\item Otherwise, if \tcode{uses_allocator_v<T1, inner_allocator_type>} is \tcode{true}
1277812774
and
@@ -12782,23 +12778,24 @@
1278212778
\begin{codeblock}
1278312779
tuple_cat(
1278412780
tuple<allocator_arg_t, inner_allocator_type&>(allocator_arg, inner_allocator()),
12785-
std::move(x))
12781+
tuple<Args1&&...>(std::move(x)))
1278612782
\end{codeblock}
1278712783

1278812784
\item Otherwise, if \tcode{uses_allocator_v<T1, inner_allocator_type>} is
1278912785
\tcode{true} and
1279012786
\tcode{is_construct\-ible_v<T1, Args1..., inner_allocator_type\&>} is \tcode{true},
1279112787
then \tcode{xprime} is:
1279212788
\begin{codeblock}
12793-
tuple_cat(std::move(x), tuple<inner_allocator_type&>(inner_allocator()))
12789+
tuple_cat(tuple<Args1&&...>(std::move(x)),
12790+
tuple<inner_allocator_type&>(inner_allocator()))
1279412791
\end{codeblock}
1279512792

1279612793
\item Otherwise, the program is ill-formed.
1279712794
\end{itemize}
1279812795
and constructs a \tcode{tuple} object \tcode{yprime} from \tcode{y} by the following rules:
1279912796
\begin{itemize}
1280012797
\item If \tcode{uses_allocator_v<T2, inner_allocator_type>} is \tcode{false} and
12801-
\tcode{is_constructible_v<T2,\\ Args2...>} is \tcode{true}, then \tcode{yprime} is \tcode{y}.
12798+
\tcode{is_constructible_v<T2,\\ Args2...>} is \tcode{true}, then \tcode{yprime} is \tcode{tuple<Args2\&\&...>(std::move(y)}.
1280212799

1280312800
\item Otherwise, if \tcode{uses_allocator_v<T2, inner_allocator_type>} is \tcode{true}
1280412801
and
@@ -12808,15 +12805,16 @@
1280812805
\begin{codeblock}
1280912806
tuple_cat(
1281012807
tuple<allocator_arg_t, inner_allocator_type&>(allocator_arg, inner_allocator()),
12811-
std::move(y))
12808+
tuple<Args2&&...>(std::move(y)))
1281212809
\end{codeblock}
1281312810

1281412811
\item Otherwise, if \tcode{uses_allocator_v<T2, inner_allocator_type>} is
1281512812
\tcode{true} and
1281612813
\tcode{is_constructible_v<T2, Args2..., inner_allocator_type\&>} is \tcode{true},
1281712814
then \tcode{yprime} is:
1281812815
\begin{codeblock}
12819-
tuple_cat(std::move(y), tuple<inner_allocator_type&>(inner_allocator()))
12816+
tuple_cat(tuple<Args2&&...>(std::move(y)),
12817+
tuple<inner_allocator_type&>(inner_allocator()))
1282012818
\end{codeblock}
1282112819

1282212820
\item Otherwise, the program is ill-formed.

0 commit comments

Comments
 (0)