Is begin() == end() for any empty() vector?
问题 I have long assumed that for any empty std::vector V , V.begin() == V.end() . Yet I see nothing in the C++ specification that states this to always be true. Is it necessarily true or does it just happen to be true on most implementations? 回答1: 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| |----------|--------------