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
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
).