[protobuf] Re: about add_field、copyfrom

2011-07-20 Thread xyluch...@163.com
.e. change the repeated Records into > repeated int32. Also if you don't need to use them simultaneously, you can > use add_allocated_record() and swap. > > On Sun, Jul 10, 2011 at 4:04 PM, xyluch...@163.com wrote: > > > > > hello: > > > we defined two

[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 ,rec