D:\VC24\Cpp\CppClassic\Ca_Hash_Boost_01\Ca_Hash_Boost_01.vcxproj
When using boost::hash_combine the order of the calls matters.
std::size_t seed = 0;
boost::hash_combine(seed, 1);
boost::hash_combine(seed, 2);
results in a different seed to:
std::size_t seed = 0;
boost::hash_combine(seed, 2);
boost::hash_combine(seed, 1);
If you are calculating a hash value for data where the order of the data doesn't matter in comparisons (e.g. a set) you will have to ensure that the data is always supplied in the same order.
Комментариев нет:
Отправить комментарий