Hello,
I wonder what I need to do to use find() from <algorithm> to search in a vector containing some Struct, with two string vars.
I'm not asking for codes now, I just want the principles. I written this, and got compilation error.
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
struct Foo {
string name;
string age;
};
int main()
{
Foo f1;
f1.name = "Misco";
f1.age = "15";
Foo f2;
f2.name = "Foo";
f2.age = "1337";
vector<Foo> v;
v.push_back(f1);
v.push_back(f2);
find(v.begin(), v.end(), "Misco");
return 0;
}