|
Boost : |
From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2000-12-12 14:47:38
> The top-level boost directory contains a _single header_ for each
> library, which provides all the declarations necessary to use that
> library:
>
> #include <boost/threads.h>
> #include <boost/regex.h>
>
I much rather have this format
#include "boost/graph/point.h"
for large libraries. The VTL library has a full set of *_fwd.h files, and a
rather large set of functional includes. It is not reasonable to include all
of them to use one of them.
Small libraries can have use your suggestion, as it seems silly to do
#include "boost/threads/threads.h"
if there is only "threads.h"
Once there gets to be more than 3 independent include files it makes much
more sense to only require users to include what is actually necessary.
My reasoning is two fold.
First compile time is reduced. (Unneeded templates are not parsed)
Second it reduces the tangling of code.
I would also like to propose that all complex libraries provide a *_fwd.h
file so that if you only want the interface to a class you can include just
*_fwd.h and not the whole implementation. I find myself wanting this for the
standard libraries. i.e. std::string, std::map etc. (That is the class has
an instance of this data type, or the member functions take one as an
argument, where the actual inline code requires the no more than the
presence of the declaration.)
-gary-
gary.powell_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk