task::then メソッド

このタスクに継続タスクを追加します。

template<
   typename _Function
>
auto then(
   const _Function& _Func
) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   cancellation_token _CancellationToken
) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   task_continuation_context _ContinuationContext
) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   cancellation_token _CancellationToken,
   task_continuation_context _ContinuationContext
) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func
) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   cancellation_token _CancellationToken
) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   task_continuation_context _ContinuationContext
) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;

template<
   typename _Function
>
auto then(
   const _Function& _Func,
   cancellation_token _CancellationToken,
   task_continuation_context _ContinuationContext
) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;

パラメーター

  • _Function
    このタスクによって呼び出される関数オブジェクトの型。

  • _Func
    このタスクが完了したときに実行される継続関数。入力として継続この関数が result_type の変数が必要 result_type が結果の型である **task<result_type>**このタスクは、生成します。

  • _CancellationToken
    継続タスクに関連付けるキャンセル トークン。キャンセル トークンなしで作成された継続タスクは継続元タスク トークンを継承します。

  • _ContinuationContext
    継続が実行するかどうかを指定する変数。この変数は Windows ストア アプリケーションで使用する場合にのみ有効です。詳細については、task_continuation_contextを参照してください。

戻り値

新しく作成された継続タスク。返されたタスクの結果の型はによって異なります _Func が返されるかによって決まります。

解説

継続タスク (単いう) 継続元が完了すると、継続元と呼ばれる、別のタスクによって呼び出される非同期タスクです。継続についての詳細を非同期処理を構成する方法を タスクの並列化 (同時実行ランタイム) ドキュメントの継続タスク を参照してください。

オーバーロードの then ラムダの取得、またはファンクタを返す Windows::Foundation::IAsyncInfoWindows ストア の apps にのみ使用できます。

必要条件

ヘッダー: ppltasks.h

名前空間: の同時実行

参照

関連項目

task クラス (同時実行ランタイム)