task::then メソッド
継続タスクをこのタスクに追加します。
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func, const task_options& _TaskOptions) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func, cancellation_token _CancellationToken, task_continuation_context _ContinuationContext) const -> typename details::_ContinuationTypeTraits<_Function, _ReturnType>::_TaskOfType;
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func, const task_options& _TaskOptions = task_options()) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;
template<
typename _Function
>
__declspec(
noinline
) auto then(const _Function& _Func, cancellation_token _CancellationToken, task_continuation_context _ContinuationContext) const -> typename details::_ContinuationTypeTraits<_Function, void>::_TaskOfType;
パラメーター
_Function
このタスクによって呼び出される関数オブジェクトの型。_Func
このタスクが完了したときに実行される継続関数。 この継続関数では、result_type または task<result_type> の変数を入力として使用する必要があります。result_type は、このタスクによって生成される結果の型です。_TaskOptions
タスク オプションには、キャンセル トークン、スケジューラ、および継続コンテキストなどがあります。 既定では、これら 3 つのオプションは継続元タスクから継承されます。_CancellationToken
継続タスクに関連付けるキャンセル トークン。 キャンセル トークンなしで作成された継続タスクは、その継続元タスクのトークンを継承します。_ContinuationContext
継続を実行する状況を指定する変数。 この変数は、Windows ストア スタイルのアプリで使用する場合にのみ役立ちます。 詳細については、「task_continuation_context」を参照してください。
戻り値
新しく作成された継続タスク。 返されるタスクの結果の型は、_Func が返す値によって決まります。
解説
Windows::Foundation::IAsyncInfo インターフェイスを返すラムダまたはファンクタを使用する then のオーバーロードは、Windows ストア アプリでのみ使用できます。
タスクの継続を使用して非同期操作を構成する方法の詳細については、「タスクの並列化 (同時実行ランタイム)」を参照してください。
必要条件
ヘッダー: ppltasks.h
名前空間: concurrency