Im working on a project and im trying to make a Json Object Literal that works like a map in C++ . My problem is that it needs a colon to match the key and the value (instead of the comma that std::map uses). Any idea how to approach this problem?
After search I realised that I cannot overload the colon operator so I thought maybe make them as strings but the colon gets in the way . Im using macros so I had the stupid idea to break the string so it could start on the first macro and finished in the end of the second macro so colon would be seen as a string but of course it didn't work .
That is what i was thinking to do in c++
auto object = std::map<std::string,Object> {
{"key1" , o1 } ,
{"key2" , o2 } ,
{"key3" , o2 }
}
and that is supposed to look as json
jsonIDMacro(id) = objmacro {
KeyMacro1(string1) : O1Macro(value) ,
KeyMacro2(string1) : O2Macro(value) ,
KeyMacro2(string1) : O2Macro(value) ,
}
Aucun commentaire:
Enregistrer un commentaire