#include <iostream>
#include <boost/unordered_set.hpp>
using namespace std;
using namespace boost;
int main()
{
unordered_set< int > hash;
unordered_set< int >::iterator it;
hash.rehash( 10 );
for( int i = 0; i < 10000; ++i ){
hash.insert( i );
if( i == 5 ){ it = hash.find( i ); }
}
cout << *it;
hash.erase( it );
return 0;
}
そしてループ内で要素数がそれを越えたため、また再ハッシュが行われるはずです。
しかし、2度目の再ハッシュ以前に取得したイテレータitは、その後も使用することができました。これは何故なのでしょう。
ハッシュ表の仕組みに対する理解が足りないのでしょうか。