mardi 3 novembre 2015

Remove vector element use the condition in vector

I have two vectors a and b with the same size.

vector<int>  a{    4,    3,   1,    3,   1};
vector<bool> b{false,false,true,false,true};

I want to remove the element in a if the same element in b (the same index) is true.

After applying the function: a = 4,3,3

Note: I want to use std algorithms or functions instead of simple for loop.

Aucun commentaire:

Enregistrer un commentaire