I've assumed the API allows to use the assignment operator to copy the
content of on message to another one like this:

MyMessage msg1, msg2;
msg1.set_name("Foo Bar");
msg2 = msg1;

My assumption was the using the API like this would be intuitively
enough to let the generated class files support it.
But as I am currently struggling with strange behaviors of my code I
took the time to analyze the protobuf API in more detail, but I could
not find any operator overloading, which delegates the assigment
operation to a call equivalent to msg2.CopyFrom(msg1). Also, examples
I could find only use those explicit method calls. So now I'm not sure
if I am using the API wrongly or not. Would you mind to let me know if
using assignment instead of 'CopyFrom' method is safe or not? I would
have to change a lot of code if I needed to call that method in order
to be safe. So I just would like to know if this effort is worth it.

Best regards,

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 
For more options, visit this group at 

Reply via email to