簡體   English   中英

如何在 c++ 中插入 protobuf map?

[英]How to insert into a protobuf map in c++?

對於以下地圖無法插入 Map

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 object 中插入 map 的方法

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM