Does C++ standard guarantee that the following code is correct?
#include <iostream>
#include <vector>
std::vector<int>::iterator i = {};
int main()
{
if (i == std::vector<int>::iterator{})
{
std::cout << "it is empty" << std::endl;
}
return 0;
}
(at least it works with MSVC2017 with both std::vector<int>
and std::set<int>
)