What std::exchange does, and how to remember it
std::exchange was introduced in the C++ standard library in C++14 under the header <utility>. Its name suggests that it’s a general-purpose and useful function, and its template prototype working with any type confirms this impression. I don’t know about you, but I always had a problem with std::exchange: I couldn’t remember what it was doing. I […]