On Jan 7, 2010, at 17:41 , Vlad wrote:
 inline const ::std::string& name() const;  //problem here need
creation of string -> very slow!

This doesn't create a string, it just returns a reference to the string already in the protocol buffer object. If you do:

const char* c_string = protobuffer.name().data()

this gets a pointer to the raw C string inside the C++ string object inside the protocol buffer object. No allocations or copies will be performed. Setting the string, one copy is always performed, as Kenton mentioned.


Evan Jones

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to