當你指的是cppreference,你會發現這一點:什麼將從std :: set.end()完全在C++中返回?
Returns an iterator to the element following the last element of the container. This element acts as a placeholder; attempting to access it results in undefined behavior.
然後我運行下面的代碼:
std::set<int> s {1, 2, 3};
cout << *s.end() << endl;
的出來說就是:,爲什麼呢?
未定義的行爲意味着任何事情都可能發生。包括三個。 – aschepler
看起來像「有效」的未定義行爲是最陰險的一種。 – user4581301
與visualC++我得到以下錯誤:「地圖/設置迭代器不可忽略」:) – r3bel