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 2013/08/06 08:08:37 UTC
[11/13] git commit: Added implicit Option to Result.
Added implicit Option<T> to Result<T>.
Review: https://reviews.apache.org/r/12487
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e8cd9ada
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e8cd9ada
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e8cd9ada
Branch: refs/heads/master
Commit: e8cd9ada8191d7db4c3fc3180b7ef53aa3bfe5b2
Parents: 419e473
Author: Benjamin Hindman <be...@gmail.com>
Authored: Thu Jul 11 14:46:52 2013 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Mon Aug 5 23:08:04 2013 -0700
----------------------------------------------------------------------
.../libprocess/3rdparty/stout/include/stout/option.hpp | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e8cd9ada/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp
index f991ae8..42b75a5 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/option.hpp
@@ -3,6 +3,8 @@
#include <assert.h>
+#include <stout/result.hpp>
+
template <typename T>
class Option
{
@@ -36,6 +38,15 @@ public:
delete t;
}
+ operator Result<T> () const
+ {
+ if (isNone()) {
+ return Result<T>::none();
+ }
+
+ return Result<T>::some(get());
+ }
+
Option<T>& operator = (const Option<T>& that)
{
if (this != &that) {