Codemod: use #include angle brackets in folly and thrift
[folly.git] / folly / wangle / Later-inl.h
index d1e1ef88c2e9239c0a6261f690a420c3249fabce..c92ceb55f8267f536eafe7e393b31a0655e6a79e 100644 (file)
@@ -16,9 +16,9 @@
 
 #pragma once
 
-#include "folly/wangle/Executor.h"
-#include "folly/wangle/Future.h"
-#include "folly/Optional.h"
+#include <folly/wangle/Executor.h>
+#include <folly/wangle/Future.h>
+#include <folly/Optional.h>
 
 namespace folly { namespace wangle {
 
@@ -53,6 +53,15 @@ Later<T>::Later() {
   future_ = starter_.getFuture();
 }
 
+template <class T>
+Later<T>::Later(Future<T>&& f) {
+  MoveWrapper<Future<T>> fw(std::move(f));
+  *this = Later<void>()
+    .then([fw](Try<void>&&) mutable {
+      return std::move(*fw);
+    });
+}
+
 template <typename T>
 Later<T>::Later(Promise<void>&& starter)
   : starter_(std::forward<Promise<void>>(starter)) { }