Skip to content

Commit d384f91

Browse files
jensmaurertkoeppe
authored andcommitted
P2401R0 Add a conditional noexcept specification to std::exchange
1 parent f37d6b2 commit d384f91

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

source/utilities.tex

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
// \ref{utility.exchange}, exchange
5454
template<class T, class U = T>
55-
constexpr T exchange(T& obj, U&& new_val);
55+
constexpr T exchange(T& obj, U&& new_val) noexcept(@\seebelow@);
5656

5757
// \ref{forward}, forward/move
5858
template<class T>
@@ -281,7 +281,7 @@
281281
\indexlibraryglobal{exchange}%
282282
\begin{itemdecl}
283283
template<class T, class U = T>
284-
constexpr T exchange(T& obj, U&& new_val);
284+
constexpr T exchange(T& obj, U&& new_val) noexcept(@\seebelow@);
285285
\end{itemdecl}
286286

287287
\begin{itemdescr}
@@ -293,6 +293,13 @@
293293
obj = std::forward<U>(new_val);
294294
return old_val;
295295
\end{codeblock}
296+
297+
\pnum
298+
\remarks
299+
The exception specification is equivalent to:
300+
\begin{codeblock}
301+
is_nothrow_move_constructible_v<T> && is_nothrow_assignable_v<T&, U>
302+
\end{codeblock}
296303
\end{itemdescr}
297304

298305

0 commit comments

Comments
 (0)