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
867 B

  1. #pragma once
  2. namespace asyncpp
  3. {
  4. template<typename T_impl>
  5. struct future_base
  6. {
  7. public:
  8. using impl_type = T_impl;
  9. public:
  10. template<typename X_future>
  11. static inline auto poll(X_future& self) = delete;
  12. template<typename X_future, typename X_lambda>
  13. static inline auto map(X_future&& self, X_lambda&& p_lambda);
  14. template<typename X_future, typename X_lambda>
  15. static inline auto and_then(X_future&& self, X_lambda&& p_lambda);
  16. };
  17. template<typename T, typename = void>
  18. struct future_trait;
  19. template<
  20. typename T_object,
  21. typename T_impl = future_trait<std::decay_t<T_object>>>
  22. struct future;
  23. /**
  24. * @brief Construct a future from the given value.
  25. */
  26. template<typename X_value>
  27. constexpr decltype(auto) as_future(X_value&& value);
  28. }