On 2019-12-08 16:48, Vinnie Falco wrote:
Consider a simple struct with members a, b, and c. We might archive it this way:
a & BOOST_SERIALIZATION_NVP("a", a); b & BOOST_SERIALIZATION_NVP("b", b); c & BOOST_SERIALIZATION_NVP("c", c);
The resulting JSON might look like this:
{ "a" : 1, "b" : 2, "c" : 3 }
You are specifying the order of the entries in the serialization code,
so I would expect this to be serialized into a JSON Array:
[ ["a", 1], ["b", 2], ["c", 3] ]
However, I acknowledge your point about reading "tagged" data from
a JSON Object. This is fairly easy to do, but does involve a bit of
boilerplate because the current serialization wrappers assume that
classes are encoded as JSON Array, so we need to use non-intrusive
serialization in order to by-pass this default behaviour.
Assuming we have a "struct alphabet" with the a, b, c variables, then
the following wrapper will read the variables in any user-modified
order. No changes to the any of the APIs are needed:
namespace trial { namespace protocol { namespace serialization {
template <typename CharT>
struct load_overloader
I was referring to stackless coroutines. That type of coroutine still has stack variables. It just doesn't save the entire stack at a suspend point. The compiler can turn any function which has statically bounded stack requirements into a "stackless coroutine."
Do you have a reference to how these stackless-with-bounded-stack coroutines works?