-
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
Implement P2770R0 "Stashing stashing iterators for proper flattening" #3466
Conversation
…range`s, pending resolution of LWG-3698 (microsoft#2727)" This reverts commit 2966813.
…erRng to be a range
This comment was marked as resolved.
This comment was marked as resolved.
It seems that P2770 breaks (P2770R0 correctly points out that cc @timsong-cpp |
That is not a scenario I care about (where's @CaseyCarter's promised paper when you need it?) - I know of no realistic range where adding That said, |
I think you should define an alias to replace
since I believe this increases readability:
|
@hewillk That's pre-existing (24 occurrences) - I would have no objection to introducing such an alias, but I think it should be done in a followup PR because so much code is affected. |
This comment was marked as resolved.
This comment was marked as resolved.
GH 3493 "<ranges>: Fix misused list-initializations" added test coverage for GH 3014 "<ranges>: list-initialization is misused". This defined an input_iterator named init_list_not_constructible_iterator. Now, P2770R0 "Stashing Stashing Iterators For Proper Flattening" is upgrading join_view and join_with_view's const overload of begin() to require forward_range<const V>. Therefore, we need to upgrade init_list_not_constructible_iterator to be a forward_iterator: * Mark its iterator_category as forward_iterator_tag. * Make it equality comparable, required for forward iterators. * Verify that it is now a forward_iterator. * Rename usage from InRange to FwdRange. Finally, this found two more improper uses of braces in <ranges>, within join_view::_Iterator_base and join_with_view::_Iterator_base.
|
I'm a greedy kitty who wants treats 😼 and is speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
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.
Looks good! Minor change, but it's pre-existing so no need to reset testing.
#endif // ^^^ workaround ^^^ | ||
|
||
template <class _Ty> | ||
_NODISCARD constexpr _Ty& _As_lvalue(_Ty&& _Val) noexcept { | ||
return static_cast<_Ty&>(_Val); |
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 since it's in the standard like this, but this static_cast
is unnecessary I believe.
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.
IIUC, this static_cast
was unnecessary before WG21-P2266, but WG21-P2266 makes _Val
an xvalue in return _Val;
, and thus an explicit cast is now needed to make it not move-eligible.
@@ -3567,37 +3567,36 @@ namespace ranges { | |||
|
|||
#ifdef __clang__ | |||
template <class _Rng> // TRANSITION, LLVM-47414 | |||
concept _Can_const_join = input_range<const _Rng> && is_reference_v<range_reference_t<const _Rng>>; | |||
concept _Can_const_join = forward_range<const _Rng> && is_reference_v<range_reference_t<const _Rng>> |
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 is pre-existing, but I really don't like how _Can_const_join
splits the primary template definition of _Join_view_base
from the specialization; adding _As_lvalue
makes this even worse. Can you move _As_lvalue
and _Can_const_join
above the primary template definition?
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 know a guy who just created a dozen cleanup PRs - I'll tell him to add this change to one of them. 😹
Thanks for implementing this feature, incrementing the repo towards C++23 conformance! 📈 🎉 😻 |
Will this be backported to a future version of VS2019? It seems that #2727 hasn't been backported to VS2019 16.11.25 yet, so I'm afraid that there's already some ABI-incompatible uses of |
At this time, we aren't planning to service VS 2019 for anything that isn't a security bug or a massively impactful bug. It's unfortunate that #2727 was merged days after we announced the backport (2022-05-23 vs. 2022-05-10), and while this means that ABI-incompatible uses aren't blocked, I believe that the affected code will be minimal. We completed C++20 and its DRs in VS 2019 but we can't keep changing it forever, and this change just missed the train. Users who are interested in using the most advanced features should really upgrade to VS 2022. |
Fixes #3450