How to solve the error of C++ capture execution
This article mainly explains "how to solve the errors when C++ captures and executes". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let's let the editor take you to learn how to solve the errors in C++ capture execution.
P.7: Catch run-time errors early catches execution error Reason as early as possible (reason)
Avoid "mysterious" crashes. Avoid errors leading to (possibly unrecognized) wrong results.
Avoid "unexplained" collapse. Avoid problems that lead to (possibly unrecognized) wrong results.
Example (sample)
Void increment1 (int* p, int n) / / bad: error-prone {for (int I = 0; I < n; + + I) + + p [I];}
Void use1 (int m) {const int n = 10; int a [n] = {}; / /. Increment1 (a, m); / / maybe typo, maybe m