I need a C++ Map with two keys and three values functionality in my program.
I declared following typedefs:
typedef pair<int, int> pair_key;
typedef tuple<string, string, string> tuple_vals;
typedef map< pair<int, int>, tuple<string, string, string> > pair_tuple_map_type;
Then I wrote following initialization of map:
pair_tuple_map_type lookup_pins
{
{
{1,0}, {"PD_13", "PD_12", "PE_15"}
},
{
{1,1}, {"PD_13", "PD_12", "PF_13"}
},
{
{4,1}, {"PE_13", "PE_14", "PD_10"}
}
};
Then I wrote following map output code:
for (const auto &lookup_row : lookup_pins)
{
auto key_pair = lookup_row.first;
string x, y, z;
tie(x, y, z) = lookup_row.second;
cout << key_pair.first << " " << key_pair.second << " " << x<< endl;
}
Above code is building with out errors and flashing/uploading to NUcleo F429Z
But it is giving following runtime error.
May I please know how to fix these errors?
My thinking is Map with two keys & three values declared above is a C++ 17 or higher feature and is not available in Mbed C++ compiler?
How to fix this C++ code please?
Thanks,
++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x2000605C, Not allowed in ISR context
Location: 0x801F16D
Error Value: 0x2000605C
Current Thread: main Id: 0x20006584 Entry: 0x801B989 StackSize: 0x1000 StackMem: 0x20004FE0 SP: 0x2002FDE0
For more info, visit: https://mbed.com/s/error?error=0x80010133&tgt=NUCLEO_F429ZI
-- MbedOS Error Info --
= System will be rebooted due to a fatal error =
= Reboot count(=1) reached maximum, system will halt after rebooting =