-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Enhancements for future and shared_future
#3284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancements for future and shared_future
#3284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This generally seems like a good change to me; there are a few extra noexcepts that are needed, imo, so that the compiler doesn't generate trys.
Thanks!
Add noexcept to _Deleter_base::_Delete, _State_deleter::_Delete, _Retain, and_Release.
strega-nil-ms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks so much!
In constructors we can expect that `this != _STD addressof(_Other)`, so the refactorization seems worthy.
CaseyCarter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are suggestions rather than requirements, so I'll go ahead and approve.
strega-nil-ms
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me!
|
Thanks - this is riskier than the average PR, but I think it preserves ABI and is a worthy improvement. I've pushed a couple of tiny changes to the test - a trivial naming nitpick (which I wouldn't have bothered with by itself), and a line to verify that the empty-braces type trait can report both |
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
Thanks for noticing the nonconformance here and carefully improving things! 🕵️ 😻 ✨ |
This PR is making some enhancements for
<future>.std::is_nothrow_move_assignable_v<std::shared_future<void>>isfalsein MSVC STL (Godbolt link), which is non-conforming. This PR fixes this bug by making internal functionsnoexcept(inspired by Mark constructors that do not throw exceptions as noexcept #3278) and some special member functions defaulted.std::future<T> ft(another_future, {});(whereanother_futureis of typestd::future<T>orstd::shared_future<T>) (Godbolt link). This PR forbids such definitions - because I think the internal constructors shouldn't be directly touched when no _Ugly name is explicitly specified, although the status quo is conforming due to [member.functions]/2._Copy_fromand_Move_fromof_State_managerinto constructors and assignment operators, and simply the codes - this is making the implementation code shorter.