среда, 27 ноября 2024 г.

Boost, boost::hash_combine, VS, Project

Boost, boost::hash_combine, 

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.

Комментариев нет:

Отправить комментарий

Boost, Asio, Github

Boost, Asio, Github https://github.com/ru-cpp-tutorials/asio-tutorial/ https://github.com/freeacetone/BoostAsioBookRussian