Search
 
SCRIPT & CODE EXAMPLE
 

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);
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: why is using namespace std a bad practice 
Cpp :: c++ hello world 
Cpp :: powershell get uptime remote computer 
Cpp :: cpp get last element of vector 
Cpp :: vector::insert 
Cpp :: throw exception c++ 
Cpp :: c++ cast to type of variable 
Cpp :: cannot jump from switch statement to this case label c++ 
Cpp :: c++ logger class example 
Cpp :: min in c++ 
Cpp :: initialize dynamic array c++ to 0 
Cpp :: union of two arrays leetcode 
Cpp :: std vector random shuffle 
Cpp :: how to write hello world in c++ 
Cpp :: cpp mark getter as const 
Cpp :: odd numbers 1 to 100 
Cpp :: c include 
Cpp :: print pattern and space in cpp 
Cpp :: iterate vector c++ 
Cpp :: input n space separated integers in c++ 
Cpp :: cpp vector 
Cpp :: c++ elif 
Cpp :: array of struct in c++ 
Cpp :: c++ client service ros 
Cpp :: system cpp 
Cpp :: resize vector c++ 
Cpp :: c++ template vs code 
Cpp :: C++ wchar_t 
Cpp :: print reverse number 
Cpp :: glfw error: the glfw library is not initialized 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =