From: Robert Ramey (ramey_at_[hidden])
Date: 2005-06-24 10:18:01
Vladimir Prus wrote:
> Robert Ramey wrote:
>>> How? Clearly, if I include base_object.hpp in a header, I cannot
>>> obey the above rule. Ok leaving just:
>>> #include <boost/serialization/access.hpp>
>>> #include <boost/serialization/split_member.hpp>
>>> #include <boost/serialization/base_object.hpp>
>> This is what I recommend. I envision that each class module
>> describe its serialization independently of any particular archive.
>> So I wouldn't expect
>> any *archive headers to be found in any class module. If this is the
>> case, the *archive.hpp first, *serialization.hpp second is very easy
>> to implement. Note that this is a reflection of one of the
>> fundamental principles of the serialization system - that
>> serialization of classes should be defined independently of any
>> particular archive.
> I don't understand you. If A.hpp contains the above, and my .cpp files
> #include "A.hpp"
> #include <boost/archive/text_oarchive.hpp>
I would not expect A.hpp to contain any inclusion of any *archive.hpp.
Doing so makes serialization of A dependent on the type of archive which is
contrary to one of the main design considerations - decoupling of
serialization from the archive type. The question arises: What is it about
A that requires knowledge of the text_archive? What happens when you want A
with a different type of archive - say in another program?
The concept that serialization of a class is totally independent of the
archive is a key concept here - and source of much of the power of library.
> Then the above rule is violated. And I do want to include my header
> first, before anything at all.
>>> in my header, and using the mandated includes order in .cpp file, I
>>> still get the same error.
>>> What should we do next?
>> Send me the example. I would be happy to review it.
> Please take a look at:
The first example BasicBlock (problem 1) compiles without problem with VC
7.1, borland, comeau but fails with gcc 3.3. This is some compiler quirk
which has nothing to do with question at hand. It is curious though and I
will look into it.
The second example is typical and very easily resolved. Just move the
*archive includes above static.h (which indirectly include the
serializations of for a class Module data.
> The first example is for base_object problem. The second is for
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk