I often have situations like this:

void do_something(const std::string& value)
{
       my_proto_buffer.set_value(value);
       // serialize my_proto_buffer to a stream
}

Would it be valid to do this:

void do_something(const std::string& value)
{
       my_proto_buffer.set_allocated_value(&((std::string&)value));
       try {
           // serialize my_proto_buffer to a stream
       }
       catch (...) {
            my_proto_buffer.release_value()
            throw;
       }
       my_proto_buffer.release_value();
}

or can I not rely on the internal string not being modified during 
serialization?

Thanks,
Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to