C++ Serialization

Using Boost Serialization
Example code: // ... boost::archive::text_oarchive oa(std::cout); Serializable serializable; oa << serializable; When using, I have had trouble with this compile error: /PATH/boost/archive/detail/oserializer.hpp:564: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE ' Apparently, this can be fixed by only serializing  instances or references: // ... boost::archive::text_oarchive oa(std::cout); Serializable serializable; const Serializable &s = serializable; oa << s; In a simple test, binary_archives were about 20 times faster than text_archives.