I have in c++ an include like that:
struct my_struct
{
time_t time;
double a, b, c, d;
}
typedef std::map<std::string, std::vector<my_struct> Data;
In my code (for debugging issue) I want to print some of the values in Data for specific key. I don't remember the syntax and keep having errors.
Here the kind of syntax I tried without success:
for (const auto& [key, value] : inputData)
{
if (key=="mytest")
{
std::cout << '[' << key << "] = " << value.a << endl;
}
}
I also tried:
for(const auto& elem : inputData)
{
if (elem.first=="mytest")
{
cout<<elem.second.a>>endl;
}
}
Thanks for your help