Creates a PPL task object. create_task can be used anywhere you would have used a task constructor. It is provided mainly for convenience, because it allows use of the auto keyword while creating tasks.
template< typename _Ty > __declspec( noinline ) auto create_task(_Ty _Param, const task_options& _TaskOptions = task_options()) -> task<typename details::_TaskTypeFromParam<_Ty>::_Type>; template< typename _ReturnType > __declspec( noinline ) task<_ReturnType> create_task(const task<_ReturnType>& _Task);
The first overload behaves like a task constructor that takes a single parameter.
The second overload associates the cancellation token provided with the newly created task. If you use this overload you are not allowed to pass in a different task object as the first parameter.
The type of the returned task is inferred from the first parameter to the function. If _Param is a task_completion_event<T>, a task<T>, or a functor that returns either type T or task<T>, the type of the created task is task<T>.
In a Windows Store app, if _Param is of type Windows::Foundation::IAsyncOperation<T>^ or Windows::Foundation::IAsyncOperationWithProgress<T,P>^, or a functor that returns either of those types, the created task will be of type task<T>. If _Param is of type Windows::Foundation::IAsyncAction^ or Windows::Foundation::IAsyncActionWithProgress<P>^, or a functor that returns either of those types, the created task will have type task<void>.