I would like to know how can I find the list of a stl vector elements that have value verifying a certain condition. For example if I have a vector of int values
vector<int> V;
and I want to get all the elements that are greater than 5.
Thanks in advance.
You'd std::copy_if() if the values:
std::vector<int> target;
std::copy_if(v.begin(), v.end(), std::back_inserter(target),
std::bind(std::less<int>(), 5, _1));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With