Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

remove first occurrence of value from vector c++

auto it = std::find(v.begin(),v.end(),3);
// check that there actually is a 3 in our vector
if (it != v.end()) {
  v.erase(it);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #remove #occurrence #vector
ADD COMMENT
Topic
Name
5+4 =