You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2015/06/14 11:46:20 UTC

[02/21] mesos git commit: Forward into _Some constructor to elide copy.

Forward into _Some constructor to elide copy.

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


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

Branch: refs/heads/master
Commit: 93b60abb4b470a644fd0a8d51708d8fddf11b1a7
Parents: 763364e
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Sat Jun 13 04:52:16 2015 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sun Jun 14 02:42:59 2015 -0700

----------------------------------------------------------------------
 .../libprocess/3rdparty/stout/include/stout/some.hpp     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/93b60abb/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp
index 1a71ac4..7c5515c 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/some.hpp
@@ -14,6 +14,9 @@
 #ifndef __STOUT_SOME_HPP__
 #define __STOUT_SOME_HPP__
 
+#include <type_traits>
+#include <utility>
+
 // A useful type that can be used to represent an Option or Result.
 //
 // Examples:
@@ -30,16 +33,16 @@
 template <typename T>
 struct _Some
 {
-  _Some(T _t) : t(_t) {}
+  _Some(T _t) : t(std::move(_t)) {}
 
-  const T t;
+  T t;
 };
 
 
 template <typename T>
-_Some<T> Some(T t)
+_Some<typename std::decay<T>::type> Some(T&& t)
 {
-  return _Some<T>(t);
+  return _Some<typename std::decay<T>::type>(std::forward<T>(t));
 }
 
 #endif // __STOUT_SOME_HPP__