In the case where swap is noexcept, we should avoid the extension to provide strong-exception guarantee.
- Group Reviewers
- rGada2a8ea4a9c: Remove the try/catch codepath if `swap` is `noexcept`.
Thanks for making this patch. Other than the noexcept issue, this LGTM.
I think it would be good to also mark this noexcept(__all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value).
I think this is OK but, are there any compilers that we support that don't support if constexpr in C++17?
I would actually prefer to not mark this noexcept, because trying to propagate noexcept down doesn't really scale.
Not that I know of...
Given the Godbolt link, I'm OK not marking this noexcept. But, I would still rather we mark it noexcept and, for what it's worth, I think we should probably also mark all those functions noexcept. IMO it's better to mark as many functions as possible with noexcept as long as the standard allows it (and that seems to be what we do in most places). For example, if we use __swap in another function/member internally and that function isn't marked noexcept, we have suddenly added a lot of bloat for _no reason at all_.