Description
For people like me who have been dealing with decltype()
and type traits for a long time, the return type of ranges::fold_meow
is still daunting.
I had to go back and forth a few times to the various overloads to really understand what the actual return type of these overloads was, because they all were specified as auto
or delctype(fold_moew(...))
, which is very unintuitive, see [alg.fold] for details.
I suspect that this way of defining return types may be extremely unfriendly to non-expert users, and it would be nice if we could spell the correct concrete type directly in the function signature, for example:
template<input_iterator I, sentinel_for<I> S, class T = iter_value_t<I>,
indirectly-binary-left-foldable<T, I> F>
constexpr decay_t<invoke_result_t<F&, iter_reference_t<I>, T>>
ranges::fold_left(I first, S last, T init, F f);
I believe this is editorial, but not sure if there are any other implicit issue with doing this.
But what is certain is that the current way of spelling the return type is indeed inconvenient.