proxygen
p1054 Namespace Reference

Functions

template<class T , class Executor >
std::pair< std::experimental::standard_promise< T >, std::experimental::standard_future< T, std::decay_t< Executor > > > make_promise_contract (const Executor &e)
 
template<class Executor , class Function , class Future >
std::experimental::standard_future< std::result_of_t< Function(std::decay_t< typename std::decay_t< Future >::value_type > &&)>, std::decay_t< Executor > > then_execute (Executor &&e, Function &&f, Future &&pred)
 
template<class Executor , class Function >
std::experimental::standard_future< std::result_of_t< std::decay_t< Function >)>, std::decay_t< Executor > > twoway_execute (Executor &&e, Function &&f)
 

Function Documentation

template<class T , class Executor >
std::pair< std::experimental::standard_promise< T >, std::experimental::standard_future< T, std::decay_t< Executor > > > p1054::make_promise_contract ( const Executor &  e)

Definition at line 77 of file then_execute_2.cpp.

References folly::gen::move.

77  {
78  std::experimental::standard_promise<T> promise;
79  auto ex = e;
80  return {promise, promise.get_future(std::move(ex))};
81 }
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
template<class Executor , class Function , class Future >
std::experimental::standard_future< std::result_of_t< Function(std::decay_t<typename std::decay_t<Future>::value_type>&&)>, std::decay_t<Executor> > p1054::then_execute ( Executor &&  e,
Function &&  f,
Future &&  pred 
)

Definition at line 88 of file then_execute_2.cpp.

References f, and folly::T.

Referenced by main().

88  {
89  using V = std::decay_t<typename std::decay_t<Future>::value_type>;
90  using T = std::result_of_t<Function(V &&)>;
91  auto pc = make_promise_contract<T>(e);
92  auto p = std::get<0>(pc);
93  auto r = std::get<1>(pc);
94  ((Future &&) pred).then([e, p, f](V v) mutable {
95  e.execute([p, f, v]() mutable { p.set_value(f(v)); });
96  return 0;
97  });
98  return r;
99 }
propagate_const< T > pc
#define T(v)
Definition: http_parser.c:233
auto f
template<class Executor , class Function >
std::experimental::standard_future< std::result_of_t<std::decay_t<Function>)>, std::decay_t<Executor> > p1054::twoway_execute ( Executor &&  e,
Function &&  f 
)

Definition at line 56 of file twoway_execute_2.cpp.

References f, and folly::T.

Referenced by main().

56  {
57  using T = std::result_of_t<std::decay_t<Function>()>;
58  auto pc = make_promise_contract<T>(e);
59  auto p = std::get<0>(pc);
60  auto r = std::get<1>(pc);
61  e.execute([p, f]() mutable { p.set_value(f()); });
62  return r;
63 }
propagate_const< T > pc
#define T(v)
Definition: http_parser.c:233
auto f