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 ,recordsetB has the same member as fieldsetA,we can only do
like this:
Record *pRecordB = recordsetB.add_record();
pRecordB->CopyFrom(*pRecordA);

we found that it cost  much time to  copy.

if there is this method,we can solve this problem:

recordasetB.add_record(pRecordA);

in this way ,we don't need to copy。

i've read topic in this forum, add_record() this api just for thread
safe and don't worry about the pRecordA being accidently changed。

so hope for your answer.

thans!!

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to