Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::execution::read_env

      From cppreference.com
      <cpp‎ |execution
       
       
      Execution control library
       
      Defined in header<execution>
      inlineconstexpr/*unspecified*/ read_env{};
      (since C++26)
      (customization point object)
      Call signature
      execution::senderauto read_env(auto&& query);
      (since C++26)

      A sender factory that returns a sender that reaches into a receiver’s environment and pulls out the current value associated with a givenquery object.

      For any query objectq, the expressionread_env(q) isexpression-equivalent to/*make-sender*/(read_env, q).

      Customization point objects

      The nameexecution::read_env denotes acustomization point object, which is a constfunction object of aliteralsemiregular class type. SeeCustomizationPointObject for details.

      [edit]Example

      An example usage of this factory is to schedule dependent work on the receiver's scheduler, which can be obtained withread_env(get_scheduler):

      std::execution::senderauto task=  std::execution::read_env(std::execution::get_scheduler)| std::execution::let_value([](auto sched){return std::execution::starts_on(sched,/*some nested work here*/);}); std::this_thread::sync_wait( std::move(task));// wait for it to finish
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/execution/read_env&oldid=176811"

      [8]ページ先頭

      ©2009-2025 Movatter.jp