-
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
Make uninitialized_meow helpers constexpr #1329
Conversation
stl/inc/xmemory
Outdated
@@ -1682,7 +1723,7 @@ _Alloc_ptr_t<_Alloc> _Uninitialized_move( | |||
const auto _ULast = _Get_unwrapped(_Last); | |||
if constexpr (conjunction_v<bool_constant<_Ptr_move_cat<decltype(_UFirst), _Ptrval>::_Really_trivial>, | |||
_Uses_default_construct<_Alloc, _Ptrval, decltype(_STD move(*_UFirst))>>) { | |||
_Copy_memmove(_UFirst, _ULast, _Unfancy(_Dest)); | |||
_Move_memmove(_UFirst, _ULast, _Unfancy(_Dest)); |
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.
I think we need to wait until we have the contexpr allocator_traits<_Alloc>::construct
const same_as<int_wrapper_move*> auto result = _Move_memmove(begin(input), end(input), begin(output)); | ||
assert(result == end(output)); | ||
assert(equal(begin(expected_move), end(expected_move), begin(output), end(output))); | ||
if (is_constant_evaluated()) { |
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.
Most of these functions currently require that we have trivial types.
To feed my paranoia and as I expect them to be used within containers I added those tests
@CaseyCarter I am currently breaking ranges::move_backward because I forgot to update it too. I think just changing the function is correct, however it is a bit ugly. We would have to use We might want to think whether this splitting up is really the right way forward. |
d4f824c
to
5ff86d1
Compare
Having looked at this a bit more I decided that I do not like the duplication/indirection at all and will come up with a different version soonish |
c36141c
to
3943390
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
/azp run |
No pipelines are associated with this pull request. |
@@ -4559,11 +4567,6 @@ _BidIt2 _Copy_backward_memmove(_BidIt1 _First, _BidIt1 _Last, _BidIt2 _Dest) { | |||
return static_cast<_BidIt2>(_CSTD memmove(_Dest_ch - _Count, _First_ch, _Count)); | |||
} | |||
|
|||
template <class _BidIt1, class _BidIt2> |
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 and its forward friend are the only things I could imagine to break something
d2b1d42
to
a3e3dc8
Compare
@mnatsuhara @CaseyCarter I rebased this on top of #872, which enabled me to find the bug I introduced. So this PR is essentially only the final commit. |
Dropping this in favor of #1407, where it actually applies |
This add some preparatory work to make our internal
_Copy_meow
and_Move_meow
helper functions constexpr enabled.I believe that some of those changes are needed for correctness during constexpr as we need to actually move if we directly emply the helpers without checking for trivial types (looking at vector)
As far as I understand we currently do not support the allocator siblings of those functions
Partially addresses #45