Skip to content

Commit 8dc94df

Browse files
committed
LWG3918 std::uninitialized_move/_n and guaranteed copy elision
[specialized.algorithms.general] Changed to "function templates" as per #6265.
1 parent a5f24f3 commit 8dc94df

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

source/algorithms.tex

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11167,13 +11167,20 @@
1116711167

1116811168
\pnum
1116911169
Some algorithms specified in \ref{specialized.algorithms}
11170-
make use of the exposition-only function template
11171-
\tcode{\placeholdernc{voidify}}:
11170+
make use of the following exposition-only function templates:
1117211171
\begin{codeblock}
1117311172
template<class T>
1117411173
constexpr void* @\placeholdernc{voidify}@(T& obj) noexcept {
1117511174
return addressof(obj);
1117611175
}
11176+
11177+
template<class I>
11178+
decltype(auto) @\exposid{deref-move}@(I& it) {
11179+
if constexpr (is_lvalue_reference_v<decltype(*it)>)
11180+
return std::move(*it);
11181+
else
11182+
return *it;
11183+
}
1117711184
\end{codeblock}
1117811185

1117911186
\rSec2[special.mem.concepts]{Special memory concepts}
@@ -11550,7 +11557,7 @@
1155011557
\begin{codeblock}
1155111558
for (; first != last; (void)++result, ++first)
1155211559
::new (@\placeholdernc{voidify}@(*result))
11553-
typename iterator_traits<NoThrowForwardIterator>::value_type(std::move(*first));
11560+
typename iterator_traits<NoThrowForwardIterator>::value_type(@\exposid{deref-move}@(first));
1155411561
return result;
1155511562
\end{codeblock}
1155611563
\end{itemdescr}
@@ -11610,7 +11617,7 @@
1161011617
\begin{codeblock}
1161111618
for (; n > 0; ++result, (void) ++first, --n)
1161211619
::new (@\placeholdernc{voidify}@(*result))
11613-
typename iterator_traits<NoThrowForwardIterator>::value_type(std::move(*first));
11620+
typename iterator_traits<NoThrowForwardIterator>::value_type(@\exposid{deref-move}@(first));
1161411621
return {first, result};
1161511622
\end{codeblock}
1161611623
\end{itemdescr}

0 commit comments

Comments
 (0)