quote:
Doesn't the placement of const effect its meaning?
Yes, it does but auto can be augmented with const and &.
ex.
int foo();
auto val = foo(); // val is int
auto const val = foo(); // val is int const
auto const & val = foo(); // val is int const & (aka const int &)
const always applies to the type on it's left (except for the exception that you can put it on the left of the first type).
We prefer to always have the const on the right of what it applies to so there's no ambiguity reading.
ex. we prefer: int const * const ptr;
over: const int * const ptr;
This is the placement control we want with the Quick Fix.
ie. const always goes on the right of auto
A test case to make the point if it helps...
#include <type_traits>
int foo() { return 42; }
int main(int, char**)
{
auto val = foo();
auto const cval = foo();
auto const & acr = foo();
const auto & car = foo();
static_assert(std::is_same<int, decltype(val)>::value);
static_assert(std::is_same<int const, decltype(cval)>::value);
static_assert(std::is_same<int const &, decltype(acr)>::value);
static_assert(std::is_same<int const &, decltype(car)>::value);
acr = 21; // error C3892: 'acr': you cannot assign to a variable that is const
return 0;
}