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

履歴 編集

concept
<execution>

std::execution::scope_token(C++26)

namespace std::execution {
  template<class Token>
  concept scope_token =
    copyable<Token> &&
    requires(const Token token) {
      { token.try_associate() } -> same_as<bool>;
      { token.disassociate() } noexcept -> same_as<void>;
      { token.wrap(declval<test-sender>()) } -> sender_in<test-env>;
    };
}

概要

scope_tokenコンセプトは、Senderと非同期スコープ間の関連付けを作成するために利用できる型Tokenに対する要件を定義する。

test-sendertest-envは、sender_in<test-sender, test-env>のモデルである未規定の型とする。

モデル

Tokenは、次のときscope_tokenのモデルとなる。

  • Token型オブジェクトのコピー構築、ムーブ構築、コピー代入、ムーブ代入から例外送出しない、かつ
  • (const修飾の可能性のある)型Tokenの左辺値tokenが与えられたとき、型decltype((sndr))senderのモデルである全ての式sndrに対して、
    • token.warp(sndr)が有効な式、かつ
    • decltype(token.warp(sndr))senderのモデルであり、かつ
    • sender_in<decltype((sndr)), E>のモデルである全てのE型に対して、completion_signatures_of_t<decltype(token.wrap(sndr)), E>completion_signatures_of_t<decltype((sndr)), E>と同一の完了シグネチャを含むこと。

#include <execution>
namespace ex = std::execution;

int main()
{
  ex::counting_scope scope;
  ex::scope_token auto token = scope.get_token();
}

出力

バージョン

言語

  • C++26

処理系

関連項目

参照