📅  最后修改于: 2022-03-11 14:44:45.779000             🧑  作者: Mango
#include
#include
#include
#include
using namespace std;
int main()
{
// intitalize both the vector and the target value to be under
vector V = {2,3,5,11};
int target = 8;
// remove any numbers in the vector that is larger than the target
vector :: iterator it = remove_if(V.begin(), V.end(), bind2nd(greater(), target));
V.erase (it, V.end());
// output the answer
copy(V.begin(), V.end(), ostream_iterator(cout, " "));
}