apply
is in scope in the for
loop body, so be assured, the error is not there. But you are aware that apply
is out of scope after the loop body?
I’m only answering this because your use of
vector2.size() - 1
will give you hell if vector2
is empty, as the above will wrap around to a large unsigned
value and your program will fail spectacularly! Use
for (int apply=0; apply + 1 < vector2.size(); apply++) {
instead.