
On Wed, Mar 23, 2005 at 06:15:14PM +0100, Thorsten Ottosen wrote:
"Jonathan Wakely" <cow@compsoc.man.ac.uk> wrote in message news:20050323165335.GA52151@compsoc.man.ac.uk... | On Wed, Mar 23, 2005 at 04:06:09PM +0000, Joaquin M Lopez Munoz wrote: | | > "I can't think of any way that this extension could | > break a conforming program, considering that users | > are not permitted to forward-declare standard | > library components" | > | > Is this really so? Why cannot I forward declare a | > stdlib component? | | Opening namespace std for anything except specialisations of standard | library templates (with user-defined types as parameters) is illegal.
yes, but why?
Because the Standard says so! :-) I think that's the rule that the DR refers to when it says "users are not permitted ...", whether it's possible/advisable in practice is a different matter. Boost already opens namespace std for various reasons (e.g declaring C library names in std::) so forward decls would be no worse than the current situation - technically illegal, but harmless and even necessary in some cases. I can't see any real compiler ever rejecting the code, only a really strict validation test suite of some kind. jon