-
Notifications
You must be signed in to change notification settings - Fork 761
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
Archive::{is_loading,is_saving}::value #360
Comments
You can actually already get this information by simply using The best place to add this to cereal would be in using is_loading = std::true_type;
using is_saving = std::false_type; as appropriate, defined within the doxygen block for the If you choose to do a pull request adding this to cereal, please do so against the current develop branch and also include appropriate doxygen comments for the new values. |
Thanks for the quick feedback (and a great library). I will put together a PR over the holiday. Having this change upstream will greatly simplify a boost -> cereal transition. |
This provides compatibility for asymmetric serialize routines when transitioning from boost serialization and associated archive types. See: USCiLab#360 Example: ``` template <typename Archive> void serialize(Archive &ar, const std::uint32_t version) { std::int16_t tmp = foo; if(Archive::is_loading::value) { ar & tmp; foo = tmp; // For illustration only } else { tmp = foo; // For illustration only ar & tmp; } ar & foo; } ```
PR merged. |
Is the following {
is_loading
,is_saving
} type addition compatible with the cereal library? This would greatly improve compatibility with existing boost serialization code and is seemingly unobtrusive.This supports the following serialization pattern:
The text was updated successfully, but these errors were encountered: