基本上异步函数通过引用或指针返回值,方法是
Fail
IAsyncOperation<Buffer*> GetBufferAsync()
{
co_await 1500ms;
return mvo_buffer;
}
Fail
IAsyncOperation<Buffer&> GetBufferAsync()
{
co_await 1500ms;
return mvo_buffer;
}
Pass
Buffer* GetBuffer()
{
return &mvo_buffer;
}
Pass
IAsyncOperation<Buffer> GetBufferAsync()
{
co_await 1500ms;
return mvo_buffer;
}
谢谢
答案 0 :(得分:1)
WinRT IAsyncOperation
的类型必须是WinRT类型(没有限定符)。在您的示例中,假设Buffer
是WinRT类型,则唯一可接受的形式是IAsyncOperation<Buffer>
。