I noticed a discrepancy between std::unordered_map and the abseil *_hash_maps.
The return value from the end() method changes. But for std::unordered_map, the value does not change.
I am working on ubuntu with g++ -std=c++17
Is this intentional?
I understand that iterators can be invalidated. However, shouldn't the value of end() be the same as the maps change, as with std::unordered_map?
Below is a snippet of a coding example.
template< typename KeyT, typename ValueT>
using UnorderedMap = absl::flat_hash_map<KeyT, ValueT>;
//// cut....
UnorderedMap<int, int> myMap; // replace with myMap(4000) to see end() change at a later instance.
UnorderedMap<int, int>::iterator theEnd = myMap.end();
for( int index=0; index < 100000; ++index)
{
myMap.emplace(index, index+1);
if( theEnd != myMap.end() )
std::cout << "the end has changed at " << index << std::endl;
}