You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2019/07/01 19:19:10 UTC

[mesos] branch master updated: Added 'operator-()' for set difference to stout.

This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new 9827fcf  Added 'operator-()' for set difference to stout.
9827fcf is described below

commit 9827fcfff69d65ca32852fa6de1b98e1e1a5ba5d
Author: Andrei Sekretenko <as...@mesosphere.io>
AuthorDate: Mon Jul 1 15:18:50 2019 -0400

    Added 'operator-()' for set difference to stout.
    
    Review: https://reviews.apache.org/r/70974/
---
 3rdparty/stout/include/stout/set.hpp | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/3rdparty/stout/include/stout/set.hpp b/3rdparty/stout/include/stout/set.hpp
index 96238a7..764fc3c 100644
--- a/3rdparty/stout/include/stout/set.hpp
+++ b/3rdparty/stout/include/stout/set.hpp
@@ -13,7 +13,7 @@
 #ifndef __STOUT_SET_HPP__
 #define __STOUT_SET_HPP__
 
-#include <algorithm> // For std::set_intersection.
+#include <algorithm> // For std::set_intersection and std::set_difference.
 #include <set>
 
 template <typename T>
@@ -49,4 +49,18 @@ std::set<T> operator&(const std::set<T>& left, const std::set<T>& right)
   return result;
 }
 
+
+template <typename T>
+std::set<T> operator-(const std::set<T>& left, const std::set<T>& right)
+{
+  std::set<T> result;
+  std::set_difference(
+      left.begin(),
+      left.end(),
+      right.begin(),
+      right.end(),
+      std::inserter(result, result.begin()));
+  return result;
+}
+
 #endif // __STOUT_SET_HPP__