pankaj kushwaha pankaj kushwaha - 3 months ago 16
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?


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.