Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
None
-
None
-
2
-
b5ed7fb20 (dev), cebb2dd06 (6.9), 7f3539202 (6.8)
-
Foundation Sprint 123
Description
We used to have qExchange(), but after it was extended twice (with constexpr (from C++20) and conditional noexcept (from C++23)), we didn't want to lock ourselves into this never-disappearing std wrapper, so we added QT_NO_QEXCHANGE and made all of Qt compile with that enabled.
That leaves two holes, one much bigger than the other:
- we have no constexpr exchange() anymore
- we have no conditional noexcept exchange() anymore
The latter doesn't matter much, as nothing in Qt queries the noexcept'ness of exchange() (it's easily expressed by std type traits), but the former prevents us from writing idiomatic code (like in QScopedValueRollback, where we need to emulate exchange() using two move()s instead.
There are other potential users (basically, any non-trivial Literal Type move-constructible type), so we should really add q20::exchange(). q23::exchange() doesn't appear needed, at this point in time.