This is UB.
The point of this rule is that the vector
might reallocate the buffer and/or move the elements around before dereferencing your iterator.
This is equally problematic for vector
iterators, pointers into it, span
iterators, etc.
This is UB.
The point of this rule is that the vector
might reallocate the buffer and/or move the elements around before dereferencing your iterator.
This is equally problematic for vector
iterators, pointers into it, span
iterators, etc.