Repository navigation
P2415 What Is A view? - #2275
Conversation
Add the move-only range adaptor `owning_view`, and use it to implement `views::all` changes to correspond with `viewable_range` changes. Resolves microsoft#2238
|
|
||
| // clang-format off | ||
|
template |
||
|
requires (movable<_Rng> && !_Is_specialization_v |
There was a problem hiding this comment.
I would prefer if we could put that into a named concept
There was a problem hiding this comment.
On first read I misinterpreted this as a request to put _Is_specialization_v into an _Is_initializer_list helper so this would more closely reflect the wording from the working draft. This makes a ton of sense to me.
Your comment on 1527, however, implies that you want the entire requires-clause (and presumably the type-constraint as well) pulled out into a helper concept. I'm inclined not to do so, again because I'd like the wording to more closely reflect the working draft. Do you have a motivating concern?
Michael Schellenberger Costa (miscco)
left a comment
There was a problem hiding this comment.
Grain of salt: the paper has not yet been available
P2415R2.zip (Zipped because GitHub refuses |
Thanks, I am not salty any more |
This comment has been minimized.
This comment has been minimized.
| return _RANGES empty(_Range); | ||
| } | ||
| _NODISCARD constexpr bool empty() const noexcept(noexcept(_RANGES empty(_Range))) /* strengthened */ | ||
|
requires _Can_empty |
There was a problem hiding this comment.
Can't we write the requires requires constraint directly? or does that need requires expression support that we don't have?
There was a problem hiding this comment.
view_interface has four occurrences of this same ad-hoc constraint, so I made a helper concept for DRY purposes. Michael Schellenberger Costa (@miscco) implemented ref_view very shortly thereafter and reused the helper, I assume also just for DRY. I copy-pasted ref_view to make owning_view and didn't give this constraint any thought at all.
TLDR: Everybody hates requires requires. Shout if you'd prefer that we spell it out explicitly here (and/or elsewhere) so as to more obviously agree with the Standard wording. Both are equivalent under as-if.
There was a problem hiding this comment.
I'm happy with the named concept.
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
|
2 years after C++20 was published, I'm glad we've finally found the answer to what a |
Add the move-only range adaptor
owning_view, and use it to implementviews::allchanges to correspond withviewable_rangechanges.Resolves #2238