-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Minimal changes to support constexpr allocation in MSVC #1313
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
Conversation
* Define `_CONSTEXPR20_DYNALLOC` macro to `constexpr` when the compiler defines `__cpp_constexpr_dynamic_alloc` and `inline` otherwise. * Implement and test `ranges::construct_at` and `ranges::destroy_at`, mark them (and `std` flavors) `_CONSTEXPR20_DYNALLOC`. * Implement `ranges::destroy` and `ranges::destroy_n` which share machinery with `ranges::destroy_at` with minimal test coverage. (More to follow.) [This is a dual of internal MSVC-PR-275909.]
|
Full disclosure: there's really no reason for |
miscco
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.
Blah blah missing test coverage, but this looks great
| auto construct_at(_Ty* const _Location, _Types&&... _Args) noexcept(noexcept(::new (const_cast<void*>( | ||
| static_cast<const volatile void*>(_Location))) _Ty(_STD forward<_Types>(_Args)...))) // strengthened | ||
| _CONSTEXPR20_DYNALLOC auto construct_at(_Ty* const _Location, _Types&&... _Args) noexcept( | ||
| noexcept(::new (const_cast<void*>(static_cast<const volatile void*>(_Location))) |
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.
HM in the uninitialized_meow PR we introduced a voidify Funktion. If it is not too far out we should wait until it is merged or reproduce it here
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.
The whole point of pushing this through before finishing test coverage is to avoid blocking the compiler team. If we get uninit_meow merged in time, I'll make the voidify change here. Otherwise, I'll do so in the followup. (Leaving this comment open as a reminder.)
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.
👍
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.
MSVC-PR-276291 is internally out for review, containing uninit_meow, so it's a race 🚀
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.
|
Does that mean we can have a look at constexpr container after this is merged (excluding string and vector of course) |
_CONSTEXPR20_DYNALLOCmacro toconstexprwhen the compiler defines__cpp_constexpr_dynamic_allocandinlineotherwise.ranges::construct_atandranges::destroy_at, mark them (andstdflavors)_CONSTEXPR20_DYNALLOC.ranges::destroyandranges::destroy_nwhich share machinery withranges::destroy_atwith minimal test coverage. (More to follow.)[This is a dual of internal MSVC-PR-275909.]
Partially implements #37 and #39.