Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

analyze/invalid-cpp-capture

This happens when a local native C++ value is captured in a context where it cannot be safely copied.

Mitigations

Avoid capturing that value directly. If possible, change the code so the captured value has a copyable type. You can also capture a pointer to it by using cpp/& in a let. Verify that the pointed-to value will outlive the closure.