Should promise’s final_suspend always return std::suspend_always?

In Josuttis book on C++20, I read that

  • final_suspend […] should always return std::suspend_always{}.

Which to me looks a bit unrealistic. If that quote corresponds to reality, then why couldn’t the standard more simply require that final_suspend return void and the compiler take care of hardcoding std::suspend_always{} at the appropriate places?

Indeed, later in the book, an awaiter other than std::suspend_always{} is returned from final_suspend.

But still I guess the quoted text is meant to say something interesting.

Leave a Reply

Your email address will not be published.