I am attempting to write a function that uses boost::serialize if an object can be serialized, with a fallback if the object cannot be written with boost::serialize. Is there some template-based way to test whether an a given class can be serialized?
// ideally, something of this form
is_boost_serializeable<T>::value
I know that I can use SFINAE to check for the existence of individual methods, but with the many different options on how to provide a serialization, I'm worried that I would miss some edge cases. As it is, I haven't been able to find anything in the boost documentation describing such a function existing already.
T
is capable of being serialized. – Bergmansstd::vector<char>
. One way to pack/unpack the data would be by creating aboost::archive::text_iarchive
/test_oarchive
. I have successfully done this before, but now want to test whether or not it is possible for a user-defined class. That way, if it is not possible, I can potentially fall back to other methods. – Bergmans