-
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
[xutility] Modernize _Ptr_meow_cat to use variable templates #872
Conversation
8ae08c2
to
4643f4f
Compare
@CaseyCarter This passes without ranges support. The problem is again that I seem to remember that you already filed an issue regarding some bug in the ternary operator that leads to common_with to be false but was unable to find it. Has that been resolved? |
I also found that e.g.
|
I have trouble understanding the test errors, as those specializations they complain do work fine in the test. Can somebody that understands meta programming help? |
So it seems that the two overloads for same type copy and pointer copy were indeed ambiguous if I added some SFINAE or that to same type copy specializations. There is still a question why MSVC accepts this code when then other major compilers do. I will try to condense this down a bit and create a ticket EDIT: filed here https://developercommunity.visualstudio.com/content/problem/1058776/compiler-accepts-ambiguous-overload-of-variable-te.html |
@CaseyCarter can I get some direction on how to fix the ostreambuf mess? |
I addressed most of the stylistic comments and will have a look on how to fix those failures |
This is driving me crazy. Why it is trying to do |
and then:
|
Argh damn it, I am always forgetting that... |
I am super unhappy that I had to essentially roll back the most useful changes to go back to that pointer only specialization. However, it seems like there are some deficiencies wrt |
I think this should be ready for the next round of reviews |
stl/inc/xmemory
Outdated
bool_constant < _Can_memmove_uninitialized<decltype(_UFirst), | ||
_Ptrval> && _Uses_default_construct<_Alloc, _Ptrval, decltype(_STD move(*_UFirst))>::value > {})); |
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.
It seems like the spacing around bool_constant
is different here than in other occurrences (specifically before and after the <
and >
), and it also looks like it is preexisting in the code before changes. Is there a reason for this?
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 believe this is clang format getting confused by the _Uses_default_construct<_Alloc, _Ptrval, decltype(_STD move(*_UFirst))>::value > {}
afterwards
I was not able to create a simple reproducer though
bool_constant<_Can_memop_elements<remove_cv_t<_Source>, remove_volatile_t<_Dest>, _Cat>>>; | ||
|
||
template <class _IterSource, class _IterDest, _Memop_cat _Cat> | ||
_INLINE_VAR constexpr bool _Can_memop<move_iterator<_IterSource>, _IterDest, _Cat> = |
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.
Shouldn't _Copy
and _Copy_uninitialized
become _Move
and _Move_uninitialized
with move_iterator
? (I know it's pre-existing but it's definitely wrong)
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 that you are right that for the _Copy
case it seems wrong. For _Copy_uninitialized
we require trivial
types anyway where it does not make a difference.
Thatsaid I am absolutely in favor of changing it accordingly
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.
Since we fixed it in #1772 it's no longer pre-existing so we should change this accordingly.
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 PR has merge conflicts now that we're using if constexpr
unconditionally.
@CaseyCarter I have rebased and updated the PR. I think we should decide whether this is worth it or simply put it in the bin |
stl/inc/memory
Outdated
if constexpr (is_same_v<_Se, | ||
_It> && is_same_v<_OSe, _Out> && _Memmove_in_uninitialized_copy_is_safe<_It, _Out>) { |
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 gods have failed me :(
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 are a number of merge conflicts - can you resolve them?
Yeah, will do over the weekend |
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.
After merging your #1771, there's a conflict in <vector>
.
So I am going to drop this and replace it with a sequence of smaller less error prone PRs:
Does that sound like a plan? |
Yeah, I think it's a good idea to split this into smaller PRs. |
This is a work in progress for #860 that I started yesterday.
With @StephanTLavavej awesome work on
_Equal_memcmp_is_safe
it went quite well.I use an enum to differentiate between the different categories. Is that ok or should I use some other means of discriminating between the categories.
There is some unfortunate code duplication because enable_if does not work on specializations of variable templates. (It complains about an unused template argument). Is that ok or has somebody a better idea?
Names are hard
That said there is some bug I need to hunt but I wanted to get the overal feedback on the approach.
The
unwrap_enum_t
part is terrible I will most likelybuild a helper template for that