Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-07-20 06:53:12


----- Original Message -----
From: "Jeff Garland" <jeff_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, July 20, 2001 6:50 AM
Subject: RE: [boost] Proposal: Require forward declaration header per
library

>
> > The main reasons for explicitly requiring that the library (and not the
3rd
> > party clients) must implement the forward declaration header is that it
is
> > difficult to create external forward declarations of templates and
because
> > creating such external forward declarations makes the client code more
> > difficult to maintain in respect to the library. For example, creating
forward
> > declarations of standard library components is not portable (see
17.4.3.1).
>
>
> Being ignorant of what the standard says here, and a big fan of forward
> declaration, a while ago I actually tried to create forward declarations
for
> parts of the standard library. As you say, it is not portable.
std::string, for
> example, turns out to have forward declarations in some standard
libraries, but
> not in others. Of course, these kind of issues can be easily solved by
> configuration.

That's well known not to work. However, for Boost libraries I think the idea
has promise. When I was primarily writing traditional OO code, forward
declaration was de rigeur, but I confess to have mostly given up the
practice as more and more of my code has become templatized. That's probably
OK if every header file is carefully written at the highest possible level
of granularity, so it's possible to avoid processing code you don't actually
need. The problem is that headers written that way are incovenient to use.

Before we embark on such a change, however, I think it's important to have
some clear idea of the potential benefit to users. Are there numbers? If
they've been posted, I must have missed them.

-Dave


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