Skip to content

any_sender_of<> did not support stop_when sender #663

@MoFHeka

Description

@MoFHeka

set_value cause template argument deduction/substitution failing

#include <unifex/any_sender_of.hpp>
#include <unifex/just.hpp>
#include <unifex/let_done.hpp>
#include <unifex/stop_when.hpp>
#include <chrono>
#include <memory>

int main() {
  using AnySender = unifex::any_sender_of<>;
  
  // Simulate the handler returning AnySender
  auto handler_sender = AnySender{unifex::just()};
  
  // Timeout duration
  std::chrono::seconds timeout(5);
  
  // This line causes compilation failure:
  // The issue is that schedule_after requires a scheduler context,
  // but we're trying to use it directly without a scheduler instance
  auto timeout_sender = std::move(handler_sender)
                        | unifex::stop_when(unifex::schedule_after(timeout));
  /*
  auto timeout_sender = std::move(handler_sender)  // Success
  */
  
  // Further processing with let_done
  auto result_sender = std::move(timeout_sender)
                       | unifex::let_done([]() {
                           return AnySender{unifex::just()};
                         });
  
  // Convert back to AnySender
  AnySender final_result{std::move(result_sender)};
  
  return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions