Part of the lambda code is compiled into machine code, and when assigned, only a pointer to a function is assigned, indicating that this code is assigned. Thus, until you no longer use the captured variables, it should be safe to reassign the variable containing the lambda, because the current code will not be changed.
source
share