No.
Both d
and e
are "singular iterators" because they point neither to an element in a sequence, or to the "one-past-the-end" pseudo-element.
And you can barely do anything with singular iterators:
[C++11: 24.2.1/5]
: Just as a regular pointer to an array guarantees that there is a pointer value pointing past the last element of the array, so for any iterator type there is an iterator value that points past the last element of a corresponding sequence. These values are called past-the-end values. Values of an iterator i
for which the expression *i
is defined are called dereferenceable. The library never assumes that past-the-end values are dereferenceable. Iterators can also have singular values that are not associated with any sequence. [ Example: After the declaration of an uninitialized pointer x
(as with int* x;
), x
must always be assumed to have a singular value of a pointer. —end example ] Results of most expressions are undefined for singular values; the only exceptions are destroying an iterator that holds a singular value, the assignment of a non-singular value to an iterator that holds a singular value, and, for iterators that satisfy the DefaultConstructible
requirements, using a value-initialized iterator as the source of a copy or move operation.
Note that, in particular, you cannot perform arbitrary comparisons on them.
I was pretty sure that even evaluating a.begin() - 1
or a.end() + 1
were UB, but I can't find any evidence of that right now.