I have a difficult time creating nested maps in C++.
First of all I have typedefed my types
typedef std::map<std::variant<int, std::string>, std::variant<int, long long int, std::string>> SimpleDict;
typedef std::map<std::variant<int, std::string>, std::variant<int, std::string,std::vector<SimpleDict>,SimpleDict>> ComplexDict;
Then I define my map:
ComplexDict m = {
"MAC0", {
{"TAG0", "111001011000"},
{"SEQ", "110000100100"},
{"IOD", "0000"}
}
};
However I get No matching constructor for initialization of 'ComplexDic
. Even if I change the type of m to std::map< std::string, std::map<std::string, std::string> >
for simplicity, I get the same error. I think I'm doing something wrong with the syntax. Could you help?
Aucun commentaire:
Enregistrer un commentaire