Can't use create_async() with WRL WinRT component

后端 未结 1 1039
自闭症患者
自闭症患者 2021-01-15 20:59

I want to write a WinRT component with async support using WRL, but I found create_async() is undefined even I included the ppltask.h and usi

1条回答
  •  迷失自我
    2021-01-15 21:41

    concurrency::create_async is only usable in C++/CX (this may not be expressly stated in the documentation, but all of the possible return types are hat types, indicating it is only usable in C++/CX).

    WRL includes the Microsoft::WRL::AsyncBase base class template, which you can derive from to implement asynchronous operations using C++ and WRL.

    I don't know of a canonical implementation that wraps std::future or concurrency::task, but you can find an example of an implementation in the Boost-licensed CxxReflect library (search for async_operation_base and task_based_async_operation).

    0 讨论(0)
提交回复
热议问题