[xutility] Modernize _Ptr_meow_cat to use variable templates - #872
[xutility] Modernize _Ptr_meow_cat to use variable templates#872Michael Schellenberger Costa (miscco) wants to merge 3 commits into
Conversation
8ae08c2 to
4643f4f
Compare
|
Casey Carter (@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? |
4643f4f to
5fa7623
Compare
|
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 |
|
Casey Carter (@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... |
026eec7 to
a6b230e
Compare
|
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 |
bcb65ec to
dd9cb66
Compare
| 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.
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.
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
This comment has been minimized.
This comment has been minimized.
dd9cb66 to
61e733f
Compare
This comment has been minimized.
This comment has been minimized.
61e733f to
ae68e7d
Compare
|
I would like to add a rename here too: We use these functions all over the place in Any disagreement? |
37eeac1 to
e161999
Compare
| 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.
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.
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.
Since we fixed it in #1772 it's no longer pre-existing so we should change this accordingly.
Stephan T. Lavavej (StephanTLavavej)
left a comment
There was a problem hiding this comment.
This PR has merge conflicts now that we're using if constexpr unconditionally.
993ddf5 to
b7cf611
Compare
|
Casey Carter (@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 |
| 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.
The gods have failed me :(
b7cf611 to
b15ebd1
Compare
Stephan T. Lavavej (StephanTLavavej)
left a comment
There was a problem hiding this comment.
There are a number of merge conflicts - can you resolve them?
|
Yeah, will do over the weekend |
b15ebd1 to
ee2aad9
Compare
Stephan T. Lavavej (StephanTLavavej)
left a comment
There was a problem hiding this comment.
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 Stephan T. Lavavej (@StephanTLavavej) awesome work on
_Equal_memcmp_is_safeit 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_tpart is terrible I will most likelybuild a helper template for that