Repository: mesos
Updated Branches:
  refs/heads/master c4a6a4844 -> 9002a748d


Added -> operator for Future.

See MESOS-2757.

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


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

Branch: refs/heads/master
Commit: 9002a748d2089490d251101b88bd71d5f855ef5f
Parents: c4a6a48
Author: Ben Mahler <[email protected]>
Authored: Tue Aug 25 15:02:43 2015 -0400
Committer: Joris Van Remoortere <[email protected]>
Committed: Tue Aug 25 16:04:15 2015 -0400

----------------------------------------------------------------------
 3rdparty/libprocess/Makefile.am                |  1 +
 3rdparty/libprocess/include/process/future.hpp |  8 ++++++
 3rdparty/libprocess/src/tests/future_tests.cpp | 31 +++++++++++++++++++++
 3 files changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/9002a748/3rdparty/libprocess/Makefile.am
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/Makefile.am b/3rdparty/libprocess/Makefile.am
index 5f215b7..7ef5158 100644
--- a/3rdparty/libprocess/Makefile.am
+++ b/3rdparty/libprocess/Makefile.am
@@ -140,6 +140,7 @@ check_PROGRAMS = tests benchmarks
 tests_SOURCES =                                                        \
   src/tests/decoder_tests.cpp                                  \
   src/tests/encoder_tests.cpp                                  \
+  src/tests/future_tests.cpp                                   \
   src/tests/http_tests.cpp                                     \
   src/tests/io_tests.cpp                                       \
   src/tests/limiter_tests.cpp                                  \

http://git-wip-us.apache.org/repos/asf/mesos/blob/9002a748/3rdparty/libprocess/include/process/future.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/future.hpp 
b/3rdparty/libprocess/include/process/future.hpp
index d2e2245..9006b8a 100644
--- a/3rdparty/libprocess/include/process/future.hpp
+++ b/3rdparty/libprocess/include/process/future.hpp
@@ -148,6 +148,7 @@ public:
   // Return the value associated with this future, waits indefinitely
   // until a value gets associated or until the future is discarded.
   const T& get() const;
+  const T* operator->() const;
 
   // Returns the failure message associated with this future.
   const std::string& failure() const;
@@ -1058,6 +1059,13 @@ const T& Future<T>::get() const
 
 
 template <typename T>
+const T* Future<T>::operator->() const
+{
+  return &get();
+}
+
+
+template <typename T>
 const std::string& Future<T>::failure() const
 {
   if (data->state != FAILED) {

http://git-wip-us.apache.org/repos/asf/mesos/blob/9002a748/3rdparty/libprocess/src/tests/future_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/tests/future_tests.cpp 
b/3rdparty/libprocess/src/tests/future_tests.cpp
new file mode 100644
index 0000000..bd33a5a
--- /dev/null
+++ b/3rdparty/libprocess/src/tests/future_tests.cpp
@@ -0,0 +1,31 @@
+/**
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License
+*/
+
+#include <gtest/gtest.h>
+
+#include <string>
+
+#include <process/future.hpp>
+
+using process::Future;
+
+using std::string;
+
+// TODO(bmahler): Migrate Future tests from process_tests.cpp.
+
+TEST(FutureTest, ArrowOperator)
+{
+  Future<string> s = string("hello");
+  EXPECT_EQ(5u, s->size());
+}

Reply via email to