std::execution::transfer(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

✨ NAME ✨

std::execution::transfer β€” std::execution::transfer (yes bestie, the NAME is literally the same thing twice and honestly? iconic 😭). This is from the C++ Standard Libary manual, section 3, and it's the page for the transfer sender adaptor. Receipts below, no cap πŸ’….


πŸ¦‹ Synopsis πŸ¦‹

Defined in header <execution>
execution::sender auto transfer(

    execution::sender auto input,
    execution::scheduler auto scheduler

);

πŸ’… Parameters πŸ’…

  • input β€” sender to be transfered on the scheduler (spelling β€œtransfered” kept exactly as the page says, bestie 😭).
  • scheduler β€” scheduler on which the sender will run.

πŸŽ€ Return value πŸŽ€

Returns a sender describing the transition from the execution agent of the input sender to the execution agent of the target scheduler. That's the whole vibe: transition, sender, execution agents, target scheduler, periodt ✨.


πŸ”₯ Example πŸ”₯

Possible usage of execution::transfer.

        execution::scheduler auto cpu_sched =
       get_system_thread_pool().scheduler();
        execution::scheduler auto gpu_sched = cuda::scheduler();

        execution::sender auto cpu_task = execution::schedule(cpu_sched);
        // cpu_task describes the creation of a new task on the system thread
       pool

        execution::sender auto gpu_task = execution::transfer(cpu_task,
       gpu_sched);
        // gpu_task describes the transition of the task graph described by
       cpu_task to the GPU

✨ cute lil sign-off ✨ source/version is http://cppreference.com, dated 2024.06.10 β€” that's the footer deets, now go slay some senders πŸ’–πŸ¦‹πŸ’…

πŸ“¦ where this page comes from