Boost logo

Boost :

Subject: Re: [boost] [config] request for BOOST_NO_FWD_STD_DECLARATION
From: John Maddock (boost.regex_at_[hidden])
Date: 2011-02-16 08:40:44


>>>> libc++ does not allow forward declarations of types for std:: , as it
>>>> uses
>>>> inline namespace to allow versioning.
>>>>
>>>> Forward declarations occur in many libraries (config, fusion,
>>>> interprocess). In each case I would like to just include the actual
>>>> headers.
>>>>
>>>> I could just #define all cases for LIBCPP, but other libraries might
>>>> move
>>>> to using inline namespaces in future, so I could introduce a macro?
>>>
>>> I think that sounds a reasonable addition, yes. Do you have patches?
>>
>> IMO it should be a macro that's defined when forward declaration is
>> possible rather than when it isn't. That way the default would be the
>> safer option. I now think it was a mistake to forward declare for
>> unknown setups in 'container_fwd.hpp'.
>
> I would be happy with that, except I note that (for example) boost fusion
> currently unconditionally forward declares std::pair, and every compiler
> in the regression test (except clang with libc++) passes the std_pair
> test. Therefore the macro would have to be added to every other compiler,
> else they would become less efficent.

Note that since this is std lib issue, and since there are only a few std
lib's out there, it's not that much of a change to Boost.Config to add this
to every std lib config except libc++ (if indeed that's what's required).

As others have noted, in principle this isn't std conforming, just useful.

John.


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