This is because it is not valid to point to an element before the first element in a container, but you are allowed to point to the element after he last element in the container. When you call
Below is an example of a vector of ints containing 0, 1, and 2:
begin() end()
|Logical |Logical
|Physical |Physical
V V
x 0 1 2 y
^ ^ ^ ^
|Logical |Physical |Logical |Physical
| | | |
rend() rend() rbegin() rbegin()
Reference: The C++ Standard Library: A Tutorial and Reference

No comments:
Post a Comment