boostorg / core

Boost Core Utilities
133 stars 83 forks source link

Rename `boost::swap` to `boost::core::invoke_swap`, deprecate `boost::swap` #149

Closed Lastique closed 1 year ago

Lastique commented 1 year ago

The rename allows to avoid forming an infinite recursion in compile time (because of noexcept specification that needs to resolve the unqualified call to swap) or run time (in case if the boost::swap function is the only one suitable for the passed arguments).

To avoid the compile-time recursion, removed noexcept specification from boost::swap. The specification is still present in boost::core::invoke_swap.

Deprecated boost::swap and associated headers. boost::core::invoke_swap is defined in a new boost/core/invoke_swap.hpp header.

Updated docs and tests. Removed tests that check inclusion of deprecated headers.

Fixes https://github.com/boostorg/core/issues/148.

pdimov commented 1 year ago

This looks good to me. @glenfe?

Lastique commented 1 year ago

Also, do we want this to be part of 1.83? I did not create any PRs updating other libraries to switch over to invoke_swap.

pdimov commented 1 year ago

It's probably too late for 1.83.

Lastique commented 1 year ago

It's probably too late for 1.83.

Yeah, I thought so too. I'll merge this after the release then. 1.83 will be released as currently is.

glenfe commented 1 year ago

Looks good to me.

We might want to delay 1.83 for other reasons (Context submodule being disconnected from master HEAD has resulted in other issues) so I want to think about getting this in.

The 1.83 beta will ship with a broken (on ARM64) Context, but it should be fixed before the 1.83 release.