#include <iostream>
#include <algorithm>
#include<vector>
struct Info{
//using in-class initializers for all the built in type data members
long unsigned int id =0;
int var1 = 0;
int var2 = 0;
float result = 0;
};
int main()
{
std::vector<Info> vec = { {1,2,3,4}, {10,20,30,40}, {100,200,300,400}, {12,22,32,44}};
int findID = 12; //id to be found
auto it = std::find_if(vec.begin(), vec.end(),[findID](const auto& e) { return e.id == findID;});
if(it!=vec.end())
{
//do something with the found element using iterator it
std::cout<<"found"<<std::endl;
std::cout<<"id: "<<(it->id)<<" var1: "<<(it->var1)<<" var2: "<<(it->var2)<<"result: "<<(it->result)<<std::endl;
}
else
{
std::cout<<"not found"<<std::endl;
}
return 0;
}