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

履歴 編集

class template
<execution>

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

namespace std::execution {
  template<queryable... Envs>
  struct env {
    Envs0 envs0_;  // exposition only
    Envs1 envs1_;  // exposition only
    // ...
    EnvsN envsN_;  // exposition only
  };

  template<class... Envs>
  env(Envs...) -> env<unwrap_reference_t<Envs>...>;
}

概要

クラステンプレートenvは、複数のクエリ可能オブジェクトからクエリ可能オブジェクトを作成する。 結果オブジェクト上に対する問い合わせは、各サブオブジェクトに対して宣言順に問い合わせを行うことで解決される。

envの特殊化は代入可能ではない。

式リストが単一要素で構成される場合を除いて、envが丸カッコを用いた式リストによる初期化をサポートするか否かは未規定

メンバ関数

名前 説明 対応バージョン
(constructor) コンストラクタ C++26
(destructor) デストラクタ C++26
query 問い合わせ C++26

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

int main()
{
  // get_allocatorとget_stop_tokenをサポートするクエリ可能オブジェクト
  auto env = ex::env{
    ex::prop(std::get_allocator, std::allocator<std::byte>{}),
    ex::prop(std::get_stop_token, std::never_stop_token{})
  };

  // メモリアロケータを問い合わせ
  auto alloc = std::get_allocator(env);
  // 停止トークンを問い合わせ
  auto token = std::get_stop_token(env);
}

出力

バージョン

言語

  • C++26

処理系

関連項目

参照