diff --git a/include/podio/ObjectID.h b/include/podio/ObjectID.h index e57256a20..0e618c280 100644 --- a/include/podio/ObjectID.h +++ b/include/podio/ObjectID.h @@ -2,6 +2,7 @@ #define PODIO_OBJECTID_H #include +#include #include #include @@ -49,4 +50,16 @@ inline void to_json(nlohmann::json& j, const podio::ObjectID& id) { } // namespace podio +template<> +struct std::hash +{ + std::size_t operator()(const podio::ObjectID& id) const noexcept + { + auto hash_collectionID = std::hash{}(id.collectionID); + auto hash_index = std::hash{}(id.index); + + return hash_collectionID ^ hash_index; + } +}; + #endif