-
Notifications
You must be signed in to change notification settings - Fork 8
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
ViewableRange seems to be overconstrained #623
Comments
The "requirements of a type" bit is also a bit confusing; we really mean something like "the requirements of an expression |
I'm away from my computer at the moment. Does anything need to change in |
No. The proposed change more closely reflects the specification of
When |
If you're replacing |
|
Speculatively implement the PR of ericniebler/stl2#623
Is this still true once we have move-only views? Had the Fight me. |
The
ViewableRange
concept is defined as:Note that pointers-to-function and pointers-to-array are never
View
s, so thedecay_t
here should beremove_cvref_t
. SinceA && (B || C)
is equivalent to(A && B) || (A && C)
, this definition is equivalent to:The
forwarding-range
concept is defined:since
A && A && B
is equivalent toA && B
, we can simplifyViewableRange
to:Now comes the question: If
remove_cvref_t<R>
is aView
, why should we concern ourselves over whether or notR
is aRange
? Aconst
specialization offilter_view
, for example, is not aRange
butView<remove_cvref_t<const filter_view<V, P>>>
holds wheneverfilter_view<V, P>
is a valid template-id. Certainly such aconst
specialization offilter_view
"can be converted to aView
safely" by making a copy.Either I'm missing something, or we can reformulate
ViewableRange
as:which would admit more types that "can be converted to a
View
safely" without admitting any types that cannot be so converted. (Note that I've put theView
requirement first here in the expectation that arguments will more commonly beView
s than *forwarding-range
*s to take advantage of the short-circuiting behavior of constraint-expressions to reduce compile times.)Proposed Resolution
Wording relative to N4810.
Modify [range.refinements]/4 as follows:
The text was updated successfully, but these errors were encountered: