Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-06-27 00:55:57


Robert Ramey wrote:

> 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
>> contains
>>
>> #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?

I never said that A.hpp includes any of *archive.hpp. It does include some
serialization/* headers. Now back to your rule. Quoting:

   "all #includes from the boost/archive directory should preceed all
   #includes from the serialization directory."

If A.hpp includes serialization/*, then in a code snippet

   #include "A.hpp"

   #include <boost/archive/text_oarchive.hpp>

The last include of text_oarchive.hpp does not precede some serialization/*
includes.
   
>> 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:
>>
>> http://zigzag.lvk.cs.msu.su/~ghost/serialization_problems/
>
> 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.

gcc is not the only compiler:

  $ como -I ~/Work/boost-rc --long_long BasicBlock.cpp
  Comeau C/C++ 4.3.3 (Oct 24 2003 16:00:23) for RedHat_LINUX_INTEL_ELF
  "/home/ghost/Work/boost-rc/boost/serialization/base_object.hpp", line 75:
  error:
            type_info_implementation is not a template
                  BOOST_DEDUCED_TYPENAME
  type_info_implementation<Base>::type::is_polymorphic,

> 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.

As I did explain, I want "static_data.h" (just like every header
corresponding to my .cpp) to be the *very first* include in my .cpp file.
Did you see my arguments? Do you find them weak? If so, can you explain
why?

- Volodya


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