I think that in the second case, it's better and if you are looking for a direct replacement, I would go with const auto. If you'd change the return type of reverse_const_copy(), there would be nothing to do on the caller side.
In the first case, I don't think it's any better. If you want to change the type, you have to update it anyway and using auto in fact just makes the code more verbose without adding any benefits.
It's debatable that it would make the code more uniform, without any benefits and with a few extra chars, let's say it's a matter of personal preference/project guidelines.
Hi, Sandor Dargo
I think the code snippets
is changed to as following by adopted keyword
auto
is better.what do you think about this?
Best regards, Gapry.
Thanks for your comment @gapry .
I think that in the second case, it's better and if you are looking for a direct replacement, I would go with
const auto
. If you'd change the return type of reverse_const_copy(), there would be nothing to do on the caller side.In the first case, I don't think it's any better. If you want to change the type, you have to update it anyway and using auto in fact just makes the code more verbose without adding any benefits.
It's debatable that it would make the code more uniform, without any benefits and with a few extra chars, let's say it's a matter of personal preference/project guidelines.
Thanks for your ideas!
Hi, @sandordargo
Thank you for your insights !
Best regards, Gapry.