
Hi, I want to write my own archive class for reading/writing to some defined binary protocol. I'm deriving my archive class from the binary_oarchive_impl template and overriding save_override functions. As protocol is defined, I don't need any additional info(bytes). So I do smth like this: class fast_binary_oarchive : // don't derive from binary_oarchive !!! public binary_oarchive_impl<fast_binary_oarchive> { typedef fast_binary_oarchive derived_t; #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS public: #else friend class boost::archive::detail::interface_oarchive<derived_t>; friend class basic_binary_oarchive<derived_t>; friend class basic_binary_oprimitive<derived_t, std::ostream>; friend class boost::archive::save_access; #endif // add base class to the places considered when matching // save function to a specific set of arguments. Note, this didn't // work on my MSVC 7.0 system // using binary_oarchive_impl<derived_t>::load_override; // so we use the sure-fire method below. This failed to work as well template<class T> void save_override(T & t, BOOST_PFTO int){ binary_oarchive_impl<fast_binary_oarchive>::save_override(t, 0); // verify that this program is in fact working by making sure // that arrays are getting passed here BOOST_STATIC_ASSERT(! (boost::is_array<T>::value) ); } // all the functions have emtpy body void save_override(const class_id_optional_type &, int) {} void save_override(const version_type&, int) {} void save_override(const class_id_type&, int) {} void save_override(const class_id_reference_type&, int) {} void save_override(const object_id_type&, int) {} void save_override(const object_reference_type&, int) {} void save_override(const tracking_type&, int) {} void save_override(const class_name_type&, int) {} public: fast_binary_oarchive(std::ostream & os, unsigned flags = no_header | no_codecvt | no_xml_tag_checking | no_tracking) : binary_oarchive_impl<derived_t>(os, flags) {} }; Is this correct? What features of the serialization library will not I be able to use?