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 2014/06/07 01:06:31 UTC

git commit: Added a hash function for PortRange.

Repository: mesos
Updated Branches:
  refs/heads/master da48fd4ee -> 7dc398f74


Added a hash function for PortRange.

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


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

Branch: refs/heads/master
Commit: 7dc398f74fde942c0f66c2a33861ba1016407c78
Parents: da48fd4
Author: Jie Yu <yu...@gmail.com>
Authored: Fri Jun 6 11:59:34 2014 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Fri Jun 6 16:06:02 2014 -0700

----------------------------------------------------------------------
 src/linux/routing/filter/ip.hpp | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/7dc398f7/src/linux/routing/filter/ip.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/ip.hpp b/src/linux/routing/filter/ip.hpp
index 52b7af7..11e417d 100644
--- a/src/linux/routing/filter/ip.hpp
+++ b/src/linux/routing/filter/ip.hpp
@@ -25,6 +25,8 @@
 #include <string>
 #include <vector>
 
+#include <boost/functional/hash.hpp>
+
 #include <stout/net.hpp>
 #include <stout/option.hpp>
 #include <stout/result.hpp>
@@ -88,6 +90,15 @@ inline std::ostream& operator << (
 }
 
 
+inline size_t hash_value(const PortRange& range)
+{
+  size_t seed = 0;
+  boost::hash_combine(seed, range.begin());
+  boost::hash_combine(seed, range.end());
+  return seed;
+}
+
+
 class Classifier
 {
 public: