cxxomfort  rel.20211024
Simple backports for C++ - https://ryan.gulix.cl/fossil.cgi/cxxomfort/
Files | Functions
Std0utility

Files

file  14-integer_sequence.hpp
 Backports for C++14's "integer_sequence" facilities.
 
file  utility.hpp
 Implementations related to Standard Header utility.
 

Functions

template<typename T , typename U = T>
exchange (T &obj, CXXO_RV_REF(U) nval)
 Replaces a variable's value, returns the old value. More...
 

Detailed Description

Function Documentation

◆ exchange()

T cxxomfort::cxxostd::exchange ( T &  obj,
CXXO_RV_REF(U)  nval 
)

Replaces a variable's value, returns the old value.

C++14 Backports:
Assign a new value to a variable and return the old value.
See also
{n3668}

The macro CXXOMFORT_IMPLEMENTS_exchange informs about the implementation status. Additionally, when cxxomfort activates this feature, it will define the macro __cpp_lib_exchange_function from SD-6.