Input archive: Add implicit serialization operator

This commit is contained in:
Eladash 2021-04-16 08:55:54 +03:00
parent 60c69df968
commit 708a1bac4e

View File

@ -700,6 +700,16 @@ namespace cereal
return *self;
}
//! Implicit conversion for serialization constant types
// Such as "const int value = ar;"
template <typename T, typename = std::enable_if_t<std::is_default_constructible_v<T> && std::is_copy_constructible_v<T>>>
operator T()
{
T value{};
process( value );
return value;
}
//! Serializes any data marked for deferment using defer
/*! This will cause any data wrapped in DeferredData to be immediately serialized */
void serializeDeferments()