dimanche 12 juillet 2020

address of a const object interpreted as low level const

In C++ Primer (5th edition) I found an example which doesn't make much sense to me:

const int i = /*some integer literal*/;

auto e = &i; 

For me &i represents the address of const int i - so the address itself is not a (low/high level) const and e should be interpreted as int *.

But this book interprets e as const int* stating the reason (& of a const object is low-level const) - Can someone please clarify what's wrong with my understanding.

Aucun commentaire:

Enregistrer un commentaire