20
General utilities library
[utilities]
20.2
Utility components
[utility]
20.2.3
exchange
[utility.exchange]
🔗
template
<
class
T,
class
U
=
T
>
constexpr
T exchange
(
T
&
obj, U
&
&
new_val
)
;
1
#
Effects
: Equivalent to:
T old_val
=
std
::
move
(
obj
)
; obj
=
std
::
forward
<
U
>
(
new_val
)
;
return
old_val;