-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature request] Automatic aggregate serialization #238
Comments
unfortunately, i have no idea how can a handle |
Great idea. One problem is that serialization for certain Archives in Boost.Serialization (e.g. XML) requires an extra level of instrospection to get the field name or, more simply, at least have a way to generate names automatically if not provided Second, I wouldn't bother with versioning aggregates. My perspective is that aggregates shouldn't be subject to versioning because in that case you have to start defaulting values which is contrary to the idea of an aggregate. (That is the price of using aggregates). |
We need to:
|
After taking a short look at pfr documentation, Wouldn't something like this be as simple as possible?
PS - how did you get the well formatted code into the GitHub comment? |
Yes, rvalue reference in my example is redundant. Lvalue enough.
|
Finally, i successfully implemented |
|
|
Looking at this a little more, I've concluded that it's kind of tricky to do right. In any case, I think it would be a much better addition to the PFR library than the serialization library. |
What exactly do you think it is hard to get right? i) Serializing aggregates in general or ii) generating the named-value pairs for specific archives that need them. I think that serializing aggregates is well defined an this approach should work, although will make Boost Serialization depend on Boost PFR (which is c++14 only I think, maybe in a couple of versions of the languages we will not even depend PFR to do this.) I think the problem of naming fields is more serious. I brought up this issue a couple of times before. There are two solutions to this problem 1) make named value pairs optional (tags with names are nice to have but not a requirement). 2) make XML-like archives take a generic named value pair-like class, rather than an specific hard coded type. |
Hi. I tried to create simple method
serialize_aggregate
using boost.pfr library (new reflection library from Antony Polukhin)This method allows me to describe serializable entities more compact:
Why not support for this method on the library side?
The text was updated successfully, but these errors were encountered: