std::execution::then(3)

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

πŸ’– NAME πŸ’–

okay so this is the std::execution::then(3) page from the C++ Standard Libary β€” manual name folded in near the top, as requested bestie πŸ’…

std::execution::then β€” std::execution::then ✨


✨ Synopsis ✨

Defined in the header <execution> 🫢

          execution::sender auto then(

              execution::sender auto input,                      (since C++26)
              std::invocable<values-sent-by(input)...> function

          );

🌸 Parameters 🌸

  • input β€” the sender that, once executed, sends the values that function runs on πŸ¦‹
  • function β€” the invocable that gets called by the new sender chained to the input sender πŸ’–

πŸ‘‘ Return value πŸ‘‘

Returns a sender describing the task graph described by the input sender, with an added node that invokes the provided function with the values sent by the input sender as arguments β€” it's giving task-graph glow-up ✨

then is guaranteed to not begin executing function until the returned sender is started. No cap, that timing detail matters πŸ’…


πŸŽ€ Example πŸŽ€

Possible usage of execution::then β€” observed, iconic, here's the demo bestie:

        execution::sender auto input = get_input();
        execution::sender auto snd = execution::then(input, [](auto... args)
        {
            std::print(args...);
        });
        // snd describes the work described by pred
        // followed by printing all of the values sent by pred

source/version/date sign-off, bestie 🫢: cppreference.com Β· 2024.06.10 Β· std::execution::then(3) β€” byeee, go slay some senders πŸ’œπŸ¦‹

πŸ“¦ where this page comes from