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
Hello, I am trying to get a combination of the generic_tree and polymorphic_container samples to obtain a polymorphic tree. But I cannot figure out how to serialize nested bonded<> fields, and I was wondering if that is supported?
The text was updated successfully, but these errors were encountered:
You will need to serialize each node data to initialize the data field, like in the polymorphic_container example. You can also use generic Node<T>, either defining the data field as 2: bonded<T> data; or as 2: T data;. In the latter case you would use Node<bonded<Data>> instance.
Thank you, that got me unstuck. Ironically, that is much closer to the structure I am experimenting with(GumboParser) as opposed to the inheritance based model I was trying initially (conventional OO bias probably).
I have also tried the approach briefly mentioned in the 'Why Bond' article to emulate union with nullable<> and that works too. I still need to dig further to figure out the trade-offs in each approach.
Also, I am curious to understand when a mapping between a C and Bond model such as this one mandates the use of bonded<> and an interim serialization, versus when it can be made blittable, possibly using transforms, but no intermediate copy.
Hello, I am trying to get a combination of the generic_tree and polymorphic_container samples to obtain a polymorphic tree. But I cannot figure out how to serialize nested bonded<> fields, and I was wondering if that is supported?
The text was updated successfully, but these errors were encountered: