Skip to content

Commit

Permalink
feat: add hash function to InventorySource (LiteLDev#1436)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dofes authored Jan 15, 2024
2 parents e605cac + b6efe60 commit 110b283
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/mc/world/inventory/transaction/InventorySource.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,14 @@ class InventorySource {

// NOLINTEND
};

#include <functional>
namespace std {
template <>
struct hash<InventorySource> {
size_t operator()(const InventorySource& key) const {
return static_cast<size_t>(key.mContainerId)
^ (static_cast<size_t>(static_cast<unsigned int>(key.mType)) << 16);
}
};
} // namespace std

0 comments on commit 110b283

Please sign in to comment.