typedef ::std::vector< int > IntArray;
…
IntArray theInts;
…
IntArray::iterator it1, it2;
….
::std::swap( it1, it2 );// error!, should be ::std::swap( *it1, *it2 );
很早以前曾犯的另一个错误:
IntArray theInts;
…
int* g_pTheInt;
…
g_pTheInt = &( *it ) or it;//无效,::std::vector会reallocate。。。
自醒。。。