Yes, a const vector
provides access to its elements as if they were const
, that is, it only gives you const
references. In your second function, it's not the objects of type A
that are const
, but pointers to them. A pointer being const
does not mean that the object the pointer is pointing to is const
. To declare a pointer-to-const, use the type A const *
.