Boost logo

Boost :

From: Michael Marcin (mmarcin_at_[hidden])
Date: 2007-11-08 14:55:43


Giovanni Piero Deretta wrote:
> On Nov 8, 2007 2:19 AM, Yingwei Zhang <ywz_at_[hidden]> wrote:
>> Hello -
>>
>> I am migrating our code base from boost 1.33.1 to 1.34.1. Some changes in boost/functional is causing compilation issues. The hash.hpp in 1.33 does include std container header files. In 1.34.1, however, forward declaration is added as following:
>>
>
> If you need the container headers you should include them, not rely on
> a third party header including it. In fact in this case conatainer_fwd
> IMHO does exactly the right thing. It forwards declare std containers
> when he thinks it is safe to do so. If It can't it includes them.
> Forward declaring standard containers without including the headers is
> something that comes handy very often.
>

And is also not legal or portable IIRC because an implementation is
allowed to add extra template parameters to a type as long as they have
defaults and these would break your forward declarations.

IMO all standard headers should have corresponding fwd headers like the
legacy iosfwd header, but since they don't AFAIK the only legal and
portable way to get the type of a standard container is to include its
header.

Thanks,

Michael Marcin


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