Is begin() == end() for any empty() vector?
Yes, that's what the standard requires it to be for empty()
for any container.
§ 23.2.1 Table 96 of the C++11 standard says:
+----------+---------------+----------------------+
|Expression| Return Type | Operational Semantics|
|----------|---------------|----------------------|
|a.empty() |Convertible |a.begin() == a.end() |
| |to bool | |
| | | |
+-------------------------------------------------+
23.2.1 General container requirements, specifically Table 96 Container Requirements has
a.empty()
convertible tobool
, operational semanticsa.begin() == a.end()
Then
6
begin()
returns an iterator referring to the first element in the container.end()
returns an iterator which is the past-the-end value for the container. If the container is empty, thenbegin() == end();
(emphasis mine)