I have a class like this:
struct DataElement {
std::string key;
std::string value;
std::string placeholder;
// some other data members
}
I store them inside a Vector.
Now i have a function which takes a vector
of these DataElement
and also creates a vector
of the DataElement
.
std::vector<DataElement> doAction(std::vector<DataElement>& data) {
auto additional_data = create_additional_data() //returns std::vector<DataElement>
//merge data and additional_data
return additional_data
}
Now i want to copy all the Elements from the vector data
into the vector additional_data
if there key is not already there.
I was thinking of using copy_if
but how do i check if the current element is already in the Destination?