Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-03-15 13:11:22

Chris Jefferson wrote:
> Peter Dimov wrote:
>> Dave Harris wrote:
>>> But suppose I have pair< pair<int,int>, pair<int,int> > ? Shouldn't
>>> that yield the same hash value as int[4] ?
>> I don't expect a pair< pair<int, int>, pair<int, int> > to be
>> frequently refactored into an int[4]. So no, I don't think that it
>> should necessarily have the same hash value as an int[4]. Similarly,
>> I don't think that vector< vector<int> > should necessarily have the
>> same hash value as its flattened vector<int> counterpart.
> Just to comment on this specifically, you really, really should have a
> vector<vector<int> > hash to the same value as it's flatterned
> conterpart.

Just to clarify, did you mean "should not have" here? Because...

> I have previously written a program where i had a set of
> vector<vector<int> >s, where when flatterned they were all the same,
> and I don't think it's that uncommon..

... this part seems to imply that these vectors should not have the same
hash value, or the unordered_set will degrade into a linked list.

Boost list run by bdawes at, gregod at, cpdaniel at, john at