In my C++/WinRT project, I am trying to run some code on UI thread but getting an error that says:
"winrt::impl::consume_Windows_UI_Core_ICoreDispatcher<winrt::Windows::UI::Core::ICoreDispatcher>::RunAsync': a function that returns 'auto' cannot be used before it is defined"
I am invoking the method like this:
Dispatcher().RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal, [=]()
{
// Code to be executed.
});
The implementation is coming from auto generated winrt file which returns auto
as a return type.
template <typename D>
struct consume_Windows_UI_Core_ICoreDispatcher
{
[[nodiscard]] auto HasThreadAccess() const;
auto ProcessEvents(Windows::UI::Core::CoreProcessEventsOption const& options) const;
auto RunAsync(Windows::UI::Core::CoreDispatcherPriority const& priority, Windows::UI::Core::DispatchedHandler const& agileCallback) const;
auto RunIdleAsync(Windows::UI::Core::IdleDispatchedHandler const& agileCallback) const;
};
Is there something that I am missing or is this a bug?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…