Open ericniebler opened 5 years ago
What nonreferenceable type other than void is returnable?
What nonreferenceable type other than void is returnable?
None - the point is to constrain the return type to what's necessary for the view's uses, rather than forbidding things that we don't want. The latter supposes that we haven't missed a case we need to forbid, and requires maintenance if the core language changes in the future.
Yes, this argues that "referenceable type" is not the proper requirement, for example, functions are referenceable types (albeit not types that can be the return type of function). I think "object type or reference to such" is more precise.
So is_object_v<remove_reference_t<invoke_result_t<F&, iter_reference_t<iterator_t<V>>>>>
?
I think the proper requirement is that it return a referenceable type. We can reuse the exposition-only
can-reference
concept, and/or admit that this constraint is useful enough to deserve a name. (And a better name, at that.)