Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-02-28 11:09:05


What I recommend is the following:

// header my_class.h

#include <boost/serialization/export.hpp>
....
// no boost/archive headers here !!!
class my_class {
....
}

BOOST_CLASS_EXPORT(my_class)

// note: header only - implementation goes below
template<class Archive>
serialize(Archive &ar, my_class &t....);

// my_class_serialization.cpp or my_class.cpp or .. *.cpp

#include <boost/archive/xml_iarchive.hpp>
.... // all archives you might whant to use here.

template<class Archive>
serialize(Archive &ar, my_class &t....){
    ... serialization for class my_class
}

#include "my_class.hpp"

// explict instantiation here for all the archives which interest me

template
void serialize<boost::archive::xml_iarchive, my_class>;
... // explicit instantiation for all other archives you might use here.

Robert Ramey

"RIVASSEAU Jean Noel" <JN.RIVASSEAU_at_[hidden]> wrote in message
news:87F60F7FA02FF749AFB02BD9FCAA6B04DE14BE_at_naserv31.nanterre.oberthurcs.com...
Hello :

Regarding my last post :

Even a manual template instantiation is in fact impossible since it would
require including the necessary archive headers (else, the boost ::archive
::xml_iarchive is not recognized). Since you forbid to include any archive
headers in the classes, I do not understand how you can follow your own
advice. This seems impossible to me. Would you have code to illustrate ?

Jean-Noël

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net