Skip to content

Commit

Permalink
Removed direct use of boost::hash_value
Browse files Browse the repository at this point in the history
std::hash suffices. boost::hash_combine is still the easiest method for combining
hashes, though.
  • Loading branch information
Vultraz committed Feb 19, 2018
1 parent dec677f commit b477f40
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/image.cpp
Expand Up @@ -81,24 +81,18 @@ struct hash<image::locator::value>
{
size_t operator()(const image::locator::value& val) const
{
using boost::hash_value;
using boost::hash_combine;

/*
* Boost 1.51.0 seems not longer accept an enumerate value in its hash
* function so cast it to a type it does like.
*/
size_t hash = hash_value(static_cast<unsigned>(val.type_));
size_t hash = std::hash<unsigned>{}(val.type_);

if(val.type_ == image::locator::FILE || val.type_ == image::locator::SUB_FILE) {
hash_combine(hash, val.filename_);
boost::hash_combine(hash, val.filename_);
}

if(val.type_ == image::locator::SUB_FILE) {
hash_combine(hash, val.loc_.x);
hash_combine(hash, val.loc_.y);
hash_combine(hash, val.center_x_);
hash_combine(hash, val.center_y_);
hash_combine(hash, val.modifications_);
boost::hash_combine(hash, val.loc_.x);
boost::hash_combine(hash, val.loc_.y);
boost::hash_combine(hash, val.center_x_);
boost::hash_combine(hash, val.center_y_);
boost::hash_combine(hash, val.modifications_);
}

return hash;
Expand Down

0 comments on commit b477f40

Please sign in to comment.