You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
943 B

  1. #pragma once
  2. #include <memory>
  3. namespace asyncpp {
  4. namespace __future {
  5. template<
  6. typename T_future,
  7. typename T_lambda>
  8. struct and_then_impl
  9. {
  10. public:
  11. using lambda_type = T_lambda;
  12. using outer_future_type = T_future;
  13. using outer_value_type = typename outer_future_type::value_type;
  14. using inner_future_type = decltype(as_future(std::declval<lambda_type>()(std::declval<outer_value_type>())));
  15. using inner_future_type_ptr = std::unique_ptr<inner_future_type>;
  16. public:
  17. lambda_type lambda;
  18. outer_future_type outer;
  19. inner_future_type_ptr inner;
  20. public:
  21. /**
  22. * @brief Constructor.
  23. */
  24. template<
  25. typename X_future,
  26. typename X_lambda>
  27. inline and_then_impl(
  28. X_future&& p_outer,
  29. X_lambda&& p_lambda);
  30. };
  31. } }