I want to save the indices of my bool vector where the vector element is false.
I have the following code:
vector<bool> incumbent_solution; // (0,0,0,1,1,0,0)...
vector<int> I_minus_S(incumbent_solution.size());
auto it = copy_if(incumbent_solution.begin(), incumbent_solution.end(),
I_minus_S.begin(), [&incumbent_solution](auto i) {if (incumbent_solution[i] == 0] return i; });
I_minus_S.erase(it, I_minus_S.end());
But it only stores True in my Vector and not the indices. What is my lambda doing wrong?