"as there is no guarantee that memory layout for
T
and const T
is the same" Your link doesn't say that, I believe? It says that vector<T>
and vector<const T>
can be different, which isn't what you're saying.