Boost logo

Boost :

Subject: Re: [boost] [config] request for BOOST_NO_FWD_STD_DECLARATION
From: Christopher Jefferson (chris_at_[hidden])
Date: 2011-02-16 07:52:35


On 16 Feb 2011, at 12:35, Mathias Gaunard wrote:

> On 15/02/2011 21:54, Christopher Jefferson wrote:
>> libc++ does not allow forward declarations of types for std:: , as it uses inline namespace to allow versioning.
>
> Is that legal?

I think so. I believe it is impossible to tell, except when trying to do forward declarations of C++ standard library types.

The question is then if forward declarations of types in std:: are allowed. From 17.6.3.2.1p1 in the current C++0x draft (there is identical text in the c++03 standard):

"The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified."

While people could read this in various ways, I would say it forbids these kinds of games, although they might work for particular standard libraries.


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