Why do we pass parameters to coroutines by value in C++?

C++ coroutines and const reference parameters A coroutine func accepts a parameter by const reference in the code below: The code is well-formed and outputs the following: until we change caller_func() as follows: The lifetime of a temporary used as a function argument is extended to that of the full expression containing the function call, so Param(15) is destroyed at semicolon and the coroutine…