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

--
Evan Jones
http://evanjones.ca/

-- 
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 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.


Reply via email to