Please, do not just apply this change. I just want to discuss this, as I am not sure myself what your goals are.
When you only hide this overload of std::swap in cases where T is not swappable the effect will be that the generic version of std::swap will become a viable candidate, and this generic swap does not require the T to be swappable. So instead, maybe you just want a hard error? If so, you can apply this commit. The note is taken from the specification of swap for std::array: http://eel.is/c++draft/array#members-5
The constraints for the member swap can be left as they are: there is no interaction with other overloads.
Please, do not just apply this change. I just want to discuss this, as I am not sure myself what your goals are.
When you only hide this overload of
std::swap
in cases whereT
is not swappable the effect will be that the generic version ofstd::swap
will become a viable candidate, and this genericswap
does not require theT
to be swappable. So instead, maybe you just want a hard error? If so, you can apply this commit. The note is taken from the specification ofswap
forstd::array
: http://eel.is/c++draft/array#members-5The constraints for the member
swap
can be left as they are: there is no interaction with other overloads.