-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix hash_value template resolution #180
Conversation
seed = begin->hash_value(); | ||
else { | ||
using sequant_boost::hash_value; | ||
[[maybe_unused]] std::size_t seed = hash_value(*begin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a functional change here where previously the hash-value of *begin
would be computed, but the result would be discarded and the original seed
would be left in an uninitialized state. This seemed like a bug to me, so I changed it but you'll probably want to double-check that this was not intended behavior after all 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, late night coding, ignored what the compiler was trying to tell me ... 5ff476d
By bringing the Boost hash_value functions into the SeQuant namespace, some instantiations of the hash_value function resolved to the general Boost functions instead of using the specializations provided by SeQuant. In particular, expression objects with a hash_value member function would simply be hashed via a generic hash_range implementation (as every expression is also a range) instead of using the template specialization that delegates to the (memoizing) hash member function. This issue is resolved by not importing the functions from the Boost namespace but instead keeping two specializations in the SeQuant namespace that either resolve to the member function (if present) or the generic Boost function (if the object does not have a hash member function and a suitable overload on Boost's side is found).
135d363
to
9f87160
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, looks good ... now that it turns out we need Boost 1.81 (#182) massive cleanup is possible, but to be done elsewhere
Fixes #179