You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I understand that the below is fundamentally useless, but I see no reason why it shouldn't work. It's essentially a transcoding from an in-memory value to the same representation. I think it should be supported for consistency's sake. This bit me when trying to write a unit test for some code where I wanted to fake receiving a bond encoded object from a server.
If I remember correctly, we decided not to implement "cloning via Bond" so that it wasn't easy to fall into a performance trap using the serialization/deserialization APIs. The "escape hatch" is to explicitly serialize to a buffer and then create a bond::bonded instance over the buffer:
Writing unit tests is the only case that I can remember where the need for this API comes up. (I've run into this exact problem myself before, and I implemented the aforementioned serialization function.)
I'd be fine with a behavior change here if someone wanted to submit it. Unit tests would be needed.
I understand that the below is fundamentally useless, but I see no reason why it shouldn't work. It's essentially a transcoding from an in-memory value to the same representation. I think it should be supported for consistency's sake. This bit me when trying to write a unit test for some code where I wanted to fake receiving a bond encoded object from a server.
MyStruct value; bond::bonded<MyStruct> bonded(value); MyStruct value2; bonded.Deserialize(value2);
The text was updated successfully, but these errors were encountered: