Giving this a bump.  This might also be considered a feature request (the 
ability to temporarily assign a string value to a protocol buffer during 
serialization, rather than copying it).

--Kevin

On Friday, March 8, 2013 1:49:29 PM UTC-8, Kevin Regan wrote:
>
> 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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
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