The Promise struct in Chapter13\sync_wait.h causes the following compilation errors:
3>C:\temp\Cpp-High-Performance-Second-Edition-master\Chapter13\task_ex.cpp(31): error C2280: 'detail::SyncWaitTask::Promise::Promise(void)': attempting to reference a deleted function
3>C:\temp\Cpp-High-Performance-Second-Edition-master\Chapter13\sync_wait.h(65): message : compiler has generated 'detail::SyncWaitTask::Promise::Promise' here
4>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include\execution(1222,5): error C2338: Parallel algorithms require forward iterators or stronger.
3>C:\temp\Cpp-High-Performance-Second-Edition-master\Chapter13\syncwait.h(65,1): message : 'detail::SyncWaitTask::Promise::Promise(void)': function was implicitly deleted because a data member 'detail::SyncWaitTask::Promise::semaphore' has either no appropriate default constructor or overload resolution was ambiguous
3>C:\temp\Cpp-High-Performance-Second-Edition-master\Chapter13\syncwait.h(59): message : see declaration of 'detail::SyncWaitTask::Promise::semaphore'
3>C:\temp\Cpp-High-Performance-Second-Edition-master\Chapter13\task_ex.cpp(26): message : see reference to function template instantiation 'int sync_wait<Task&>(T)' being compiled
3> with
3> [
3> T=Task &
3> ]
3>Done building project "Chapter13-Asynchronous_Programming_With_Coroutines.vcxproj" -- FAILED.
I believe the issue is caused by std::binary_semaphore, which is used incorrectly. According to the documentation, this class has to be initialized with the internal counter. Here it is used without any parameters:
The
Promise
struct inChapter13\sync_wait.h
causes the following compilation errors:I believe the issue is caused by
std::binary_semaphore
, which is used incorrectly. According to the documentation, this class has to be initialized with the internal counter. Here it is used without any parameters: