[libcxx-commits] [libcxx] [libc++] Add `__exchange` as a C++11 utility (PR #187953)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue May 5 02:42:43 PDT 2026
================
@@ -24,14 +27,21 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-#if _LIBCPP_STD_VER >= 14
template <class _T1, class _T2 = _T1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept(
- is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) {
+[[nodiscard]] _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1
----------------
philnik777 wrote:
The `_LIBCPP_ALWAYS_INLINE` isn't desired either, and I'm getting quite annoyed by @cjdb adding it randomly.
https://github.com/llvm/llvm-project/pull/187953
More information about the libcxx-commits
mailing list