From: Christopher Dykes Date: Sun, 4 Jun 2017 18:35:40 +0000 (-0700) Subject: Resolve the circular dependency between folly/futures/detail/Core.h and Future.h... X-Git-Tag: v2017.06.05.00~1 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=7c600a5aa70de803215a9328e6c2b032772d46e7;ds=sidebyside Resolve the circular dependency between folly/futures/detail/Core.h and Future.h and Promise.h Summary: Do this by moving the two helpers that need to refer to them into `folly/futures/helpers.h`. Reviewed By: yfeldblum Differential Revision: D5179109 fbshipit-source-id: bdb319ff3432d3629a955c1390dc8bf6f27f4ce6 --- diff --git a/folly/futures/detail/Core.h b/folly/futures/detail/Core.h index b196b664..fd73e276 100644 --- a/folly/futures/detail/Core.h +++ b/folly/futures/detail/Core.h @@ -27,8 +27,7 @@ #include #include #include -#include -#include +#include #include #include @@ -422,45 +421,6 @@ class Core final { std::function interruptHandler_ {nullptr}; }; -template -struct CollectAllVariadicContext { - CollectAllVariadicContext() {} - template - inline void setPartialResult(Try& t) { - std::get(results) = std::move(t); - } - ~CollectAllVariadicContext() { - p.setValue(std::move(results)); - } - Promise...>> p; - std::tuple...> results; - typedef Future...>> type; -}; - -template -struct CollectVariadicContext { - CollectVariadicContext() {} - template - inline void setPartialResult(Try& t) { - if (t.hasException()) { - if (!threw.exchange(true)) { - p.setException(std::move(t.exception())); - } - } else if (!threw) { - std::get(results) = std::move(t); - } - } - ~CollectVariadicContext() noexcept { - if (!threw.exchange(true)) { - p.setValue(unwrapTryTuple(std::move(results))); - } - } - Promise> p; - std::tuple...> results; - std::atomic threw {false}; - typedef Future> type; -}; - template