📜  删除特定向量元素c++代码示例

📅  最后修改于: 2022-03-11 14:44:47.806000             🧑  作者: Mango

代码示例1
#include 
#include 

// using the erase-remove idiom

std::vector vec {2, 4, 6, 8};
int value = 8 // value to be removed
vec.erase(std::remove(vec.begin(), vec.end(), value), vec.end());