[libcxx-commits] [libcxx] [libc++] Add `__exchange` as a C++11 utility (PR #187953)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 23 03:26:04 PDT 2026


frederick-vs-ja wrote:

Looks like that we're unfortunately relying on assigning `void*` with a null pointer constant of an integer type.

Also, it seems that most (if not all) touched cases are equivalent to `std::__exchange(obj, {})`, although it seems somehow undesired to use `{}`. Would it be better to invent a new function for this purpose? See also [P2226](https://wg21.link/p2226).

https://github.com/llvm/llvm-project/pull/187953


More information about the libcxx-commits mailing list