-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Don't include <xmemory>
in <optional>
and <variant>
#3624
Don't include <xmemory>
in <optional>
and <variant>
#3624
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.
Seems reasonable, but I don't like removing explicit dependencies, personally (since the throughput gains are negligible).
@@ -104,7 +104,7 @@ struct _Optional_destruct_base<_Ty, false> { // either contains a value of _Ty o | |||
|
|||
_CONSTEXPR20 ~_Optional_destruct_base() noexcept { | |||
if (_Has_value) { | |||
_Destroy_in_place(_Value); | |||
_Value.~_Ty(); |
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.
No change requested: I observe that we're storing remove_cv_t<_Ty> _Value;
and saying only ~_Ty()
. This seems to be acceptable according to the Standardese, and all compilers accept, so I don't think we need to add remove_cv_t
here.
Looks good to me, thanks! I think that the breaking change impact here is limited - |
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for finding and implementing this throughput improvement! 🚀 🐇 🐆 |
Separated from #3623.
std::variant
andstd::optional
forbid using an array type as component, so it's unnecessary to include<xmemory>
to obtain_Destroy_in_place
.I think it's OK to writeEdit: dropping this due to review comments.<xutility>
for short. Several other headers, including conditionally included<compare>
, are already handled in<xutility>
.Edit: I also need to reduce the
numeric_limits
depedency (needed for EDG?). I expect that the current approach is transient.