Skip to content

<concepts>: LWG-3175 has been accepted, so we should remove commented-out code #537

Description

Our implementation of swappable_with speculatively implemented the proposed resolution for LWG-3175 (a Library Issue, which is a bug report against the C++ Standard):

STL/stl/inc/concepts

Lines 183 to 195 in e034296

template <class _Ty1, class _Ty2>
concept swappable_with =
#if 1 // Implement the PR of LWG-3175
common_reference_with<_Ty1, _Ty2>
#else // ^^^ LWG-3175 / N4810 vvv
common_reference_with<const remove_reference_t<_Ty1>&, const remove_reference_t<_Ty2>&>
#endif // select LWG-3175 vs. N4810
&& requires(_Ty1&& __t, _Ty2&& __u) {
_RANGES swap(static_cast<_Ty1&&>(__t), static_cast<_Ty1&&>(__t));
_RANGES swap(static_cast<_Ty2&&>(__u), static_cast<_Ty2&&>(__u));
_RANGES swap(static_cast<_Ty1&&>(__t), static_cast<_Ty2&&>(__u));
_RANGES swap(static_cast<_Ty2&&>(__u), static_cast<_Ty1&&>(__t));
};

At the February 2020 meeting in Prague, LWG-3175 was resolved for C++20. Therefore, we should keep line 186 here, but remove lines 185 and 187-189.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationRelated to documentation or commentsfixedSomething works now, yay!good first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions