I am a beginner in c++ and need a simple way to search for a specific struct element within a vector using a unique ID.
e.g. i have the following:
typedef struct {
long unsigned int id;
int var1;
int var2;
float result;
}struct_t;
vector <struct_t> strct;
now how can i search for a specific id using std::find_if on the vector struct and get a pointer to the struct?
aren't there constructs like:
struct_t*p_struct = find_if(strct.begin(),strct.end(), {strct.id == 21} );