You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2017/04/06 23:31:07 UTC

mesos git commit: Added a 'std::hash' specialization for 'ResourceProviderID'.

Repository: mesos
Updated Branches:
  refs/heads/master 8b92c9702 -> 26ce6b595


Added a 'std::hash' specialization for 'ResourceProviderID'.

This makes it possible to use 'ResourceProviderID' as key in a
'std::hashmap'.

Review: https://reviews.apache.org/r/58201/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/26ce6b59
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/26ce6b59
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/26ce6b59

Branch: refs/heads/master
Commit: 26ce6b59532beecd487bd30c5e2b6c2f8566b34c
Parents: 8b92c97
Author: Jan Schlicht <ja...@mesosphere.io>
Authored: Thu Apr 6 16:30:57 2017 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Thu Apr 6 16:30:57 2017 -0700

----------------------------------------------------------------------
 include/mesos/type_utils.hpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/26ce6b59/include/mesos/type_utils.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp
index 2cfbe10..b91a96c 100644
--- a/include/mesos/type_utils.hpp
+++ b/include/mesos/type_utils.hpp
@@ -596,6 +596,22 @@ struct hash<mesos::MachineID>
   }
 };
 
+
+template <>
+struct hash<mesos::ResourceProviderID>
+{
+  typedef size_t result_type;
+
+  typedef mesos::ResourceProviderID argument_type;
+
+  result_type operator()(const argument_type& resourceProviderId) const
+  {
+    size_t seed = 0;
+    boost::hash_combine(seed, resourceProviderId.value());
+    return seed;
+  }
+};
+
 } // namespace std {
 
 #endif // __MESOS_TYPE_UTILS_H__