> i did some google search, and found that i should use std::find_if. but i'm unable to make it work
Since the vector of integers is sorted (if it is not sorted, sort it first), use std::binary_search http://en.cppreference.com/w/cpp/algorithm/binary_search
(Lot more efficient if the vector contains some non-trivial number of integers)
great! and what if i want to delete the elem, instead of changing it to 0? this line didn't work if(std::find(i.cbegin(), i.cend(), elem.n) != i.end()) elem.erase();
it's kinda obvious, since elem is an instance of the class, and not the vector itself. i don't know how to access the vector to delete elem.