Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-12-21 09:29:43


Mikhail Kubzin wrote:
> I have got one more question. If I were to use class A in some .cpp
> file, where I am not interested in serialization, do I still need to
> include serialization/archive/.. headers in that .cpp? Is it
> posssible to avoid
> that?

Absolutely NOT. That is the whole idea of maintainence of
the concept of a serializable class distinct from that of an archive!!!

So your example below should be altered to illustrate this. Note movement
of #include <boost/archive/polymorphic_archive.hpp> to the implementation
file A.cpp.

Robert Ramey

>
> -----------------------------------------------------------------------
> A.h
>
> #include <boost/serialization/version.hpp>
> #include <boost/serialization/export.hpp>
> namespace boost {
> namespace serialization {
> class access;
> }
> }
> class A
> {
> };
> BOOST_CLASS_VERSION(A, 1)
> BOOST_CLASS_EXPORT(A)
> -----------------------------------------------------------------------
> A.cpp
>
> #include <boost/archive/polymorphic_archive.hpp>
> #include "A.h"
> <<<<===== #include <boost/archive/polymorphic_archive.hpp>????
> <<implementation>
> -----------------------------------------------------------------------
> B.cpp
>
> #include "A.h"
> void B::foo()
> {
> A a;
> a.DoSomething();
> }
> ------------------------------------------------------------------------
>
> Thank you very much in advance!
>
> Mikhail
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk