You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mz...@apache.org on 2019/05/14 15:05:52 UTC

[mesos] 03/04: Relaxed `Promise` constructor and assignment operator requirements.

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

mzhu pushed a commit to branch 1.7.x
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 25e34307cab7201d62f2463f35b421f7c4bbe269
Author: Benjamin Bannier <be...@mesosphere.io>
AuthorDate: Thu Oct 18 09:33:35 2018 +0200

    Relaxed `Promise` constructor and assignment operator requirements.
    
    This patch enables construction and assignment from rvalues for
    `Promise` values.
    
    Review: https://reviews.apache.org/r/69041/
---
 3rdparty/libprocess/include/process/future.hpp | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/3rdparty/libprocess/include/process/future.hpp b/3rdparty/libprocess/include/process/future.hpp
index ba21201..deea369 100644
--- a/3rdparty/libprocess/include/process/future.hpp
+++ b/3rdparty/libprocess/include/process/future.hpp
@@ -707,7 +707,12 @@ public:
   explicit Promise(const T& t);
   virtual ~Promise();
 
-  Promise(Promise<T>&& that);
+  // Not copyable, not assignable.
+  Promise(const Promise& that) = delete;
+  Promise(Promise&& that) = default;
+  Promise& operator=(const Promise&) = delete;
+  Promise& operator=(Promise&&) = default;
+
 
   bool discard();
   bool set(const T& _t);
@@ -728,10 +733,6 @@ private:
   template <typename U>
   bool _set(U&& u);
 
-  // Not copyable, not assignable.
-  Promise(const Promise<T>&);
-  Promise<T>& operator=(const Promise<T>&);
-
   // Helper for doing the work of actually discarding a future (called
   // from Promise::discard as well as internal::discarded).
   static bool discard(Future<T> future);
@@ -805,11 +806,6 @@ Promise<T>::~Promise()
 
 
 template <typename T>
-Promise<T>::Promise(Promise<T>&& that)
-  : f(std::move(that.f)) {}
-
-
-template <typename T>
 bool Promise<T>::discard()
 {
   if (!f.data->associated) {