最終更新日時(UTC):
が更新

履歴 編集

class template
<execution>

std::execution::basic-receiver(C++26)

namespace std::execution {
  template<class Sndr, class Rcvr, class Index>
    requires valid-specialization<env-type, Index, Sndr, Rcvr>
  struct basic-receiver {                    // exposition only
    using receiver_concept = receiver_t;

    using tag-t = tag_of_t<Sndr>;            // exposition only
    using state-t = state-type<Sndr, Rcvr>;  // exposition only
    static constexpr const auto& complete = impls-for<tag-t>::complete;   // exposition only

    template<class... Args>
      requires callable<decltype(complete), Index, state-t&, Rcvr&, set_value_t, Args...>
    void set_value(Args&&... args) && noexcept {
      complete(Index(), op->state, op->rcvr, set_value_t(), std::forward<Args>(args)...);
    }

    template<class Error>
      requires callable<decltype(complete), Index, state-t&, Rcvr&, set_error_t, Error>
    void set_error(Error&& err) && noexcept {
      complete(Index(), op->state, op->rcvr, set_error_t(), std::forward<Error>(err));
    }

    void set_stopped() && noexcept
      requires callable<decltype(complete), Index, state-t&, Rcvr&, set_stopped_t> {
      complete(Index(), op->state, op->rcvr, set_stopped_t());
    }

    auto get_env() const noexcept -> env-type<Index, Sndr, Rcvr> {
      return impls-for<tag-t>::get-env(Index(), op->state, op->rcvr);
    }

    basic-state<Sndr, Rcvr>* op;             // exposition only
  };
}

概要

basic-receiverは、Senderアルゴリズム動作仕様定義で用いられる説明専用のクラステンプレートである。

basic-receiver<Sndr, Rcvr, Index>receiverのモデルであり、SenderアルゴリズムのReceiverとしてして子Senderとの接続時に利用される。

  • Sndr : SenderアルゴリズムのSender
  • Rcvr : Senderアルゴリズムの接続先Receiver。Senderアルゴリズム同士を連結する場合は、親Senderアルゴリズム側のReceiver型。
  • Index : Senderアルゴリズムの子Sender識別用インデクス値。Senderアダプタは通常1個の子Senderと接続され、この場合はIndex()は定数値0となる。

説明専用エンティティ

template<template<class...> class T, class... Args>
concept valid-specialization =  // exposition only
  requires { typename T<Args...>; };

template<class Index, class Sndr, class Rcvr>  // exposition only
using env-type = call-result-t<
  decltype(impls-for<tag_of_t<Sndr>>::get-env), Index,
  state-type<Sndr, Rcvr>&, const Rcvr&>;

バージョン

言語

  • C++26

関連項目

参照