Say I have a set:
std::unordered_set<int> mints;
Then I do:
mints.erase(foo);
But mints doesn't contain foo! Is it guaranteed that nothing bad will happen, and that erase will simply just return 0 ?
如果您通过用erase( const key_type& key )
获得了重载的erase()
,并且该键不存在,则不会发生任何不良情况,这将是一个无操作,并且erase()
将返回0
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.