In short words:
Per C++ Primer, pg 69, "auto": "If we want the deduced type to have a top-level const, we must say so explicitly".
I would get an top-level const pointer:
int i = 42;
const auto *p = &i;
But the resulted p has type const int *
instead of expected int * const
. I can even reassign it p = 0;
. why?
(note: the format of pointer type deduction using auto *
is from the book.)
const int *p = &i;
is not top-levelconst
, either. That has nothing to do withauto
.int *
", no it doesn't.