I have a vector of struct label_diff.
label_diff contains "string" and integer.
I want to check if a vector of label_diff contains equal elements based on the "string"of each element
in .h
struct label_diff {
string label;
int diff;
label_diff(string l = " ", int i = 0)
{
label = l;
diff = i;
}
};
in main:
int main()
{
vector<label_diff> KNN;
label_diff temp;
temp.label= "Red";
temp.diff= 25689;
label_diff temp2;
temp2.label= "Red";
temp2.diff= 444;
label_diff temp3;
temp3.label= "Red";
temp3.diff= 0;
// check if all elements have same label
if() {cout>>"Same Label"}
return 0;
}
I know I can loop on the elements with a for loop to know the label name but is there a way to use the built in function std::equal() ?