andreasbuhr / cppcoro

A library of C++ coroutine abstractions for the coroutines TS
MIT License
364 stars 53 forks source link

std::exchange needs #include <utility> #43

Closed raulh39 closed 2 years ago

raulh39 commented 2 years ago

gcc 12 no longer includes \<utility> when including \<chrono>.

This means that the compilation under gcc 12 fails with this message:

~/cppcoro/lib/static_thread_pool.cpp: In member function ‘cppcoro::static_thread_pool::schedule_operation* cppcoro::static_thread_pool::try_global_dequeue()’:
~/cppcoro/lib/static_thread_pool.cpp:670:51: error: ‘exchange’ is not a member of ‘std’; did you mean ‘std::__atomic_impl::exchange’?
  670 |                                 auto* next = std::exchange(tail->m_next, head);
      |                                                   ^~~~~~~~

This pull request fixes it.

andreasbuhr commented 2 years ago

Thx a lot. Fixed by other pull request.