Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

insert only unique values into vector

std::vector<std::string> name;

....
if (std::find(name.begin(), name.end(), someName) == name.end()) {
  // someName not in name, add it
  name.push_back(someName);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #insert #unique #values #vector
ADD COMMENT
Topic
Name
1+1 =