如何在 C++ 中填充重复的自定义协议缓冲区字段?
示例协议缓冲区:
package protocol;
import "enumerations.proto";
option optimize_for=SPEED;
message UserCommandProtocol {
required uint64 utcTime=1;
required uint64 playerId=2;
optional int32 targetId=3;
optional int32 number=4;
message pair {
required float first = 1;
required float second = 2;
}
repeated uint64 bucketId=5 [packed=true];
repeated pair points=6;
repeated pair backupPoints=7;
required COMMANDS command=8;
optional Type type=9;
optional Orientation orientation=10;
optional COMMANDS_PRIORITY priority=11;
}
我只有填充点的问题。在我的代码中,我有一个 object std::list<std::pair<float,float>> p
,我想将这些值复制到UserCommandProtocol points
.