How hard would it be to modify the code generator so that whenever there was
a field of type "bytes", a method was generated called
assign_allocated(const char*, int nSize), that instead of creating an
std::string(), would just store the raw pointer as well as the size, and not
take ownership of the buffer?  Then when it was serializing, it would just
do a memcpy(buf, size) into the serialized stream?  I guess if you then
called mutable_fieldname()->assign() it would just NULL out the pointer and
do what it normally does, and vice versa if you had previously called
mutable_fieldname()->assign(), and then called this, it would remove the
previous one and store your pointer.

--~--~---------~--~----~------------~-------~--~----~
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