Re: [protobuf] about add_field、copyfrom

2011-07-12 Thread Pherl Liu
In C++ protobuf, each message owns its fields. That said, two different messages cannot share a sub-message, which will complicate the system when releasing resources. In your case, if you always need to copy the records, there may be a better design. For instance, keep the records in a global

[protobuf] about add_field、copyfrom

2011-07-10 Thread xyluch...@163.com
hello: we defined two object in field.proto message Record{ optional int id = 1; } message RecordSet{ repeated Record record= 1; } so when we define a Record pointer,we do like this: RecordSet recordsetA,recordsetB; Recrod *pRecordA = recordsetA.add_record(); pRecordA-set_id(111); actually