Closed lawabider closed 3 years ago
Did you include FutureEx.h?
#include "path/to/RStein.AsyncCpp/AsyncPrimitives/FutureEx.h"
Please be aware that support for the shared_future is experimental and should be used only for quick integration of the existing code. Due to the internal structure of the std::shared_future, an awaiter s not efficient and wastes thread. (https://github.com/renestein/Rstein.AsyncCpp/blob/master/RStein.AsyncCpp/AsyncPrimitives/FutureEx.h#L103)
Please use the type Task
Also please be aware that I will soon upgrade the code to the 'standard' coroutine support on Visual Studio 2019 (/await switch is obsolete). (https://devblogs.microsoft.com/cppblog/c-coroutines-in-visual-studio-2019-version-16-8/) This change will also have an impact on the shared_future (a drop of the experimental namespace for coroutine etc.)
I did include FutureEx.h. I'll just avoid std::shared_future for now.
Closing. Feel free to reopen.
Do you have any idea why this is? I have set the c++ version to latest and added /await compiler flag.
I am able to co_await a std::future, so I am probably able to use a lot of Rstein.AsyncCpp already.
This doesn't compile:
I get: 1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\future(1034,1): error C3312: no callable 'await_resume' function found for type 'std::shared_future'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\future(1034,1): error C3312: no callable 'await_ready' function found for type 'std::shared_future'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\future(1034,1): error C3312: no callable 'await_suspend' function found for type 'std::shared_future'
So this isn't compiling: