Move getTry to subclasses.
[folly.git] / folly / futures / Future.h
index 2179623b593db88ac2fa92cbaa55d213182a6bc5..20a56b7e05aa612751979cc87f7a80b58a10eff1 100644 (file)
@@ -106,9 +106,6 @@ class FutureBase {
   /// sugar for getTry().hasException()
   bool hasException();
 
-  /** A reference to the Try of the value */
-  Try<T>& getTry();
-
   /// If the promise has been fulfilled, return an Optional with the Try<T>.
   /// Otherwise return an empty Optional.
   /// Note that this moves the Try<T> out.
@@ -233,7 +230,6 @@ class SemiFuture : private futures::detail::FutureBase<T> {
   /* implicit */ SemiFuture(Future<T>&&) noexcept;
 
   using Base::cancel;
-  using Base::getTry;
   using Base::hasException;
   using Base::hasValue;
   using Base::isActive;
@@ -256,6 +252,10 @@ class SemiFuture : private futures::detail::FutureBase<T> {
   /// exception).
   T get(Duration dur) &&;
 
+  /// Block until the future is fulfilled, or until timed out. Returns the
+  /// Try of the value (moved out).
+  Try<T> getTry() &&;
+
   /// Block until this Future is complete. Returns a reference to this Future.
   SemiFuture<T>& wait() &;
 
@@ -392,7 +392,6 @@ class Future : private futures::detail::FutureBase<T> {
   Future& operator=(Future<T2>&&);
 
   using Base::cancel;
-  using Base::getTry;
   using Base::hasException;
   using Base::hasValue;
   using Base::isActive;
@@ -646,6 +645,9 @@ class Future : private futures::detail::FutureBase<T> {
   /// exception).
   T get(Duration dur);
 
+  /** A reference to the Try of the value */
+  Try<T>& getTry();
+
   /// Block until this Future is complete. Returns a reference to this Future.
   Future<T>& wait() &;