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.
template<class ArchiveType, std::uint32_t Flags = 0>
class OutputArchive : public detail::OutputArchiveBase
{
public:
typedef bool_<false> is_loading; // <- proposal
typedef bool_<true> is_saving; // <- proposal
// ...
};
This supports the following serialization pattern:
struct Bar
{
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;
}
std::int32_t foo;
};
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: