Question: What is the type of *(container.end())
? If size < capacity (vector) does *vec.end()
point to NULL or a default value of the type stored in the vector?
One minute response: Attempting to follow the end iterator is an undefined operation, so it may be that *c.end()
doesn't even return a value (it could crash the program, for example); if it does return a value, it can be a value of arbitrary type.
What v.end()
points to is implementation dependent, but the most obvious implementation is to have v.end()
point to v[v.size()]
.
This page last modified on 16 July 2003.