I think the decltype(auto) lambda returns const auto&;
the auto lambda returns just auto (no reference nor constant) - but a copy;
the not specified returns the same as auto (will return a copy of arg)
auto never deduces to a reference. decltype(auto) can deduce to a reference. It returns a prvalue type (auto) if return value is of type rvalue and an lvalue type (auto &) if the return value is of type lvalue.
It's used with a templated function when the return is based upon the template type. Basically, value in, value out - ref in, ref out.
yes I had asked something similar. In this case I am asking for a particular situation, to wit:
Is the following true:
I think the decltype(auto) lambda returns const auto&;
the auto lambda returns just auto (no reference nor constant) - but a copy;
the not specified returns the same as auto (will return a copy of arg)