From Effective C++, Item 3
/* case1 */ const std::vector<int>::iterator i // i acts like a T* const
/* case2 */ std::vector<int>::const_iterator ci // ci acts like a const T*
To remember how const
applies, I used to remember the following from this article
Basically ‘const’ applies to whatever is on its immediate left (other than if there is nothing there in which case it applies to whatever is its immediate right).
When I read the Item 3 in the book first, I expected it to be the other way round in case1 and case2.
Should I treat this case as an exception? Or is there some deeper level understanding that I am missing?