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.
 
 
 

40 lines
772 B

  1. #pragma once
  2. #include "stream.h"
  3. namespace asyncpp
  4. {
  5. /* stream */
  6. template<
  7. typename T_value,
  8. typename T_impl>
  9. template<
  10. typename X_object>
  11. stream<T_value, T_impl>
  12. ::stream(X_object&& p_ref)
  13. : ref(std::forward<X_object>(p_ref))
  14. { }
  15. template<
  16. typename T_value,
  17. typename T_impl>
  18. typename stream<T_value, T_impl>::result_type
  19. stream<T_value, T_impl>
  20. ::poll()
  21. { return trait_type::poll(*this); }
  22. /* misc */
  23. template<typename X_value>
  24. constexpr decltype(auto) as_stream(X_value&& value)
  25. {
  26. using value_type = X_value;
  27. using stream_type = stream<value_type>;
  28. return stream_type(std::forward<X_value>(value));
  29. }
  30. }