简体   繁体   中英

How to insert into a protobuf map in c++?

For the following Maps unable to insert into the Map

map<string, double> doubleProps = 4;
map<string, int32> intProps = 5;
map<string,string> stringProps=6;

Here are the following which I have tried, but its not working

doubleProps["key"]="value" //doesn't work
*(doubleProps["key"]).insert("value") //doesn't work
doubleProps.insert("key","value")

This is the way to insert into a map in protobuf object in c++

(*mutable_stringprops())["key"]=value

https://developers.google.com/protocol-buffers/docs/reference/cpp-generated#map-fields

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM