-
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
Is an array type a valid iterator value type? #183
Comments
For reference: find, count, search_n, remove, remove_copy, lower_bound, upper_bound, equal_range, binary_search, min, max, minmax. |
I agree. Array types are bogus value types.
We can probably just remove these sanity checks from range-v3, cmcstl2, and the Ranges TS. I added them to keep myself honest when I was designing and implementing proxy iterator support. Now they only serve to make compile times worse. Holler if you see a reason to keep them.
The
with
A bit chattier, but so be it. The larger issue is what to do about iterators with these strange (e.g. array, abstract, function) value types? See ericniebler/range-v3#474. |
See ericniebler/range-v3@5ae0a14.
This isn't quite right for proxy iterators, actually. This would be closer:
At least, it would make sense to go through the effected algorithms and see where the extra latitude would be useful. |
So, should we be enforcing your intuition?
Given that the problem is "fixed" by (a) removing the extra superfluous I'm now firmly back on the fence about this one given that proxy iterators make dropping the trick rather messy. |
I've never found the "trick" offensive; I'm happy to keep it around now that it works with array types. |
From microsoft/Range-V3-VS2015#9, range-v3 rejects:
IndirectCallableRelation<equal_to, projected</*...*/>, const char(*)[2]>()
is not satisfied becauseReadable<const char(*)[2]>()
is not satisfied because both of these two requirements:fail. (
common_reference_t</*...*/>
in both cases isconst char*
.) More generally, all of the algorithms that have aconst T&
parameter which is constrained via anIndirect
concept as if using aconst T*
iterator will fail similarly whenT
is an array type.Options:
is_same_v<T, decay_t<T>>
holds for value types, so I can't really present this option without some negative bias.) I think this choice weakens the model due to the lack of regularity of array types.IndirectFoo</*...*/, const T*>()
trick to constrain algorithms that acceptconst T&
. This may not be as messy as it seems - all of the affected algorithms useIndirectCallableRelation
or its aliasesIndirectlyComparable
andIndirectStrictWeakOrder
.The text was updated successfully, but these errors were encountered: