0
我想用C++/CX創建一個WinRT組件。我有以下代碼,它不會編譯。它有什麼問題? 從我所瞭解的PPL任務應該透明地轉換爲IAsyncOperation如果它是一個任務與結果。WinRT C++/CX任務不編譯
IAsyncOperation<Boolean>^ Class::OpAsync()
{
return create_task([]() { return true; });
}
錯誤消息
error C2440: 'return' : cannot convert from 'Concurrency::task<_ReturnType>' to 'Windows::Foundation::IAsyncOperation<TResult> ^'
with
[
_ReturnType=bool
]
and
[
TResult=bool
]
No user-defined-conversion operator available, or
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called