You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by id...@apache.org on 2014/06/26 02:14:38 UTC

[2/2] git commit: Add some relation operators to os::Release

Add some relation operators to os::Release

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


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

Branch: refs/heads/master
Commit: 50e1b120578e1626daba630515218fea27acc340
Parents: e878c74
Author: Ian Downes <id...@twitter.com>
Authored: Mon Jun 23 16:12:52 2014 -0700
Committer: Ian Downes <id...@twitter.com>
Committed: Wed Jun 25 17:13:47 2014 -0700

----------------------------------------------------------------------
 .../3rdparty/stout/include/stout/os.hpp         | 24 ++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/50e1b120/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
index 0529f88..0825172 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
@@ -1129,6 +1129,30 @@ inline Try<std::string> sysname()
 // The OS release level.
 struct Release
 {
+  bool operator == (const Release& other)
+  {
+    return version == other.version &&
+      major == other.major &&
+      minor == other.minor;
+  }
+
+  bool operator < (const Release& other)
+  {
+    // Lexicographic ordering.
+    if (version != other.version) {
+      return version < other.version;
+    } else if (major != other.major) {
+      return major < other.major;
+    } else {
+      return minor < other.minor;
+    }
+  }
+
+  bool operator <= (const Release& other)
+  {
+    return *this < other || *this == other;
+  }
+
   int version;
   int major;
   int minor;