|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2019-11-30 20:45:23
On 11/30/19 12:26 PM, Vinnie Falco via Boost wrote:
> On Sat, Nov 30, 2019 at 12:05 PM Robert Ramey via Boost
> <boost_at_[hidden]> wrote:
>>> So if I want to go from a JSON archive to my user-defined struct T,
>>> using Boost.Serialization, then the path is from JSON to a
>>> map/unordered_map, and then to T?
>>
>> No.
>
> I was asking Bjorn, because he brought up using std::map or
> std::unordered_map as an intermediate step.
LOL - I'm not allowed to chime in when I want?
>
>> So given your user-defined struct T, you can produce a compatible
>> archive using ojson_archive - and nothing else. Then you can load that
>> archive in to another instance of your user-defined T - but nothing else.
>
> What if I produce a JSON archive for my T, then edit the JSON and
> change the order of the keys, and then try to load it back in to a T?
In general, you can't do this. It's not supported.
If this is what you want to do, you need to use another library such as
google protocols. But then you have to specify data syntax by hand and
graft code to transform your T back and forth between the two. This
would be the use case for your library and "serialization".
Robert Ramey
>
> Thanks
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk