如何插入 C++ 中的 protobuf 映射?

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

以下地图无法插入地图

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

以下是我试过的,但不起作用

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

这是在c++的protobuf对象中插入map的方法

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

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