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

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

commit f6b17e447b3d816cd64f5a9b88fb7e81f42c85b9
Author: Meng Zhu <[email protected]>
AuthorDate: Fri Mar 8 17:36:52 2019 -0800

    Added `Try` constructors from `_Some`.
    
    This is necessary in cases such as constructing
    `Result<T>` from `T`:
    ```
      Result(const T& _t)
        : data(Some(_t)) {}
    ```
    to avoid unnecessary implicit conversions and copies.
    
    Review: https://reviews.apache.org/r/70171
---
 3rdparty/stout/include/stout/try.hpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/3rdparty/stout/include/stout/try.hpp 
b/3rdparty/stout/include/stout/try.hpp
index 30cce7e..2882d06 100644
--- a/3rdparty/stout/include/stout/try.hpp
+++ b/3rdparty/stout/include/stout/try.hpp
@@ -55,6 +55,12 @@ public:
   Try(T&& t)
     : data(Some(std::move(t))) {}
 
+  template <typename U>
+  Try(const _Some<U>& some) : data(some) {}
+
+  template <typename U>
+  Try(_Some<U>&& some) : data(std::move(some)) {}
+
   // We don't need to implement these because we are leveraging
   // Option<T>.
   Try(const Try& that) = default;

Reply via email to