pankaj kushwaha pankaj kushwaha - 1 month ago 7
C++ Question

unable to insert data in a stl map of map of map

I have following map declaration :

std::map<std::string, std::map<std::string, std::map<std::string, std::string>>> m;


I tried inserting data in following way :

m.insert({ "HARDWARE\\DESCRIPTION\\System\\BIOS", { "REG_SZ", { "SystemSKU", "SystemSKU" } } });


but its not working , what is correct syntax to insert data?

Answer

If you cannot get it to work with initializer lists you could use the classical way:

m["HARDWARE\\DESCRIPTION\\System\\BIOS"]["REG_SZ"]["SystemSKU"] = "SystemSKU";

Hope this helps.

Comments