title: Is there a better way to express nested namespaces in C++ within the header
body: <p>I switched from C++ to Java and C# and think the usage of namespaces/packages is much better there (well structured). Then I came back to C++ and tried to use namespaces the same way but the required syntax is horrible within the header file.</p>
  
  <pre><code>namespace MyCompany
  {
      namespace MyModule
      {
          namespace MyModulePart //e.g. Input
          {
              namespace MySubModulePart
              {
                  namespace ...
                  {
                      public class MyClass    
  </code></pre>
  
  <p>The following seems strange to me too (to avoid the deep indent):</p>
  
  <pre><code>namespace MyCompany
  {
  namespace MyModule
  {
  namespace MyModulePart //e.g. Input
  {
  namespace MySubModulePart
  {
  namespace ...
  {
       public class MyClass
       {
  </code></pre>
  
  <p>Is there a shorter Way to express the above thing? I am missing something like</p>
  
  <pre><code>namespace MyCompany::MyModule::MyModulePart::...
  {
     public class MyClass
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>Ok, some say the concept of usage in Java/C# and C++ is different. Really? I think (dynamic) class loading is not the only purpose for namespaces (this is a very technical reasoned perspective). Why shouldn't I use it for a readability and structurization, e.g think of "IntelliSense".</p>
  
  <p>Currently, there is no logic / glue between a namespace and what you can find there. Java and C# does this much better... Why including <code>&lt;iostream&gt;</code> and having namespace <code>std</code>?
  Ok, if you say the logic should rely on the header to include, why does the #include  does not uses an "IntelliSense" friendly syntax like <code>#include &lt;std::io::stream&gt;</code> or <code>&lt;std/io/stream&gt;</code>? I think the missing structurization in the default libs is one weakness of C++ compared to Java/C#.</p>
  
  <p>If uniqueness to avid conflicts is one Point (which is a point of C# and Java, too) a good idea is to use the project name or company name as namespace, don't you think so?</p>
  
  <p>On the one hand it's said C++ is the most flexible... but everyone said "don't do this"?
  It seems to me C++ can do many things but has a horrible syntax even for the easiest things in many cases compared to C#.</p>
  
  <p><strong>Update 2</strong></p>
  
  <p>Most users say it is nonsense to create a deeper nesting than two Levels. Ok, so what about Windows::UI::Xaml and Windows::UI::Xaml::Controls::Primitives namespaces in Win8 development? I think Microsoft's usage of namespaces makes sense and it is indeed deeper than just 2 Levels.
  I think bigger libraries / projects need a deeper nesting (I hate class names like ExtraLongClassNameBecauseEveryThingIsInTheSameNameSpace... then you could put everything into the global namespace, too.)</p>
  
  <p><strong>Update 3 - Conclusion</strong></p>
  
  <p>Most say "don't do it", but... even boost has a deeper nesting then one or two levels. Yes, it is a library but: If you want reusable code - treat your own code like a library you would give someone else. I also use a deeper nesting for discovery purposes using namespaces.</p>