C++ Map with two Keys and Three Values

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?


++ 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 =


Mutex API - Note: Because of the mutexes in the Arm C standard library, you cannot use stdio (printf,putc,getcand so on),malloc and new in ISR.

Same rule for all read/write methods of all peripherals where the the mutex is implemented - I2C, CAN and so on.

BR, Jan

Hi @Swamy_Jagannatham,

Just a note on the forum categories. The Mbed Studio category is specifically for discussion of the Mbed Studio IDE. Questions like this probably belong in the general Mbed OS category. This will help others find your question :slight_smile:


Hi Jan,

Thank you very much for the excellent information.

Best regards,

Hi Matthew,
Thank you very much for the information.

Best regards,