我正在使用Protobuf3,我需要创建一个地图列表。
我以为我可以使用repeated map<string, string>
但似乎我不能。
我应该使用什么?
感谢
答案 0 :(得分:3)
基本上,map<...>
与:
repeated TypedPair ...
与
message TypedPair {
KeyType key = 1;
ValueType value = 2;
}
所以repeated map<...>
将是repeated repeated TypedPair
,这是没有意义的。
相反,定义具有地图的类型,并使用:
message HazMap {
map<...> map = 1;
}
...
repeated HazMap maps = 1;
这可能是隐含的吗?也许 - 但现在不是。