How to get on top-level const pointer using "auto"?
c++, c++11
Solution
In your example, `p` is a pointer to a `const int`, not a `const` pointer to an `int`. The latter can be achieved with the following statement:
auto* const p = &i;
Problem
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.)