Boost logo

Boost :

From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2005-06-24 02:46:30


----Original Message----
From: Robert Ramey [mailto:ramey_at_[hidden]]
Sent: 23 June 2005 17:07
To: boost_at_[hidden]
Subject: Re: [boost] [serialization] new STATIC_ASSERTION_FAILURE

> Vladimir Prus wrote:
>
>>> "all #includes from the boost/archive directory should preceed all
>>> #includes from the serialization directory."
>>
>> This rule means that I can't include
>> <boost/serialization/base_object.hpp>
>> in my headers, and then in my cpp file first include my headers and
>> then archive headers. And I do want to include my header first in
>> .cpp, in order to detect any missing includes in the header itself.
>
> I don't really understand this.

Many people (myself included) have a rule that header files are self
contained. If you need something in the header file, you #include the
header and that is all you have to do. To police this, and to make sure
that the program is not compiling "by accident" because every current
occurance of the header happens to be preceded by the required headers, the
standard form of a file xxx.cpp in my projects is:
  #include "universal.h" // Absolutely standard includes that would be
                         // boring to include in every header - like
windows.h
  #include "xxx.h" // Prove that xxx.h is self contained.

Some people have an even stronger form of the rule without the universal.h -
they will have a REAL problem with requiring an order of includes.

I read your explanation of why you have the requirement on the order of
includes, and it seems to buy some advantages for some people (but not all).
It *is* quite a high cost though; not having used serialization, I can't say
whether it is worth it.

-- 
Martin Bonner
Martin.Bonner_at_[hidden]
Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ,
ENGLAND Tel: +44 (0)1223 441434

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