Topic: Declaring namespace A::B


Author: "Victor Bazarov" <vAbazarov@dAnai.com>
Date: 28 Aug 2002 22:15:15 GMT
Raw View
"Giovanni Bajo" <giovannibajo@REMOVEliberoTHIS.it> wrote...
> Hello,
>
> why is it not possible to declare a namespace (either expanding it, or
from
> scratch) like:
>
> namespace A::B
> {
>   // ....
> }
>
> This should be exactly equivalent to:
>
> namespace A { namespace B {
>   // ...
> }}
>
> but less verbose, while it's still very intuitive.

What I would like to know is why it is impossible to _extend_
a namespace using its alias...

------------------------------ somewhere
namespace A { namespace B {
    ...
}}
namespace A_B = A::B;
----------------------------- somewhere else
#include <somewhere>
namespace A_B {  // not allowed, must be original-namespace-name
    ...
}
-------------------------------------------

?

It can't be for protection against wild name replacements because
it could be done with macros, anyway.  So, why is it?

Victor
--
Please remove capital A's from my address when replying by mail


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: "Giovanni Bajo" <giovannibajo@REMOVEliberoTHIS.it>
Date: Wed, 13 Mar 2002 17:10:49 CST
Raw View
Hello,

why is it not possible to declare a namespace (either expanding it, or from
scratch) like:

namespace A::B
{
  // ....
}

This should be exactly equivalent to:

namespace A { namespace B {
  // ...
}}

but less verbose, while it's still very intuitive.

Giovanni Bajo

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]