1

I have the namespaces like so:

namespace Jimmyt1988
{
    namespace PlatformGame
    {
        namespace Helpers
        {
        }
    }        
}

I'd be just as happy to do something like this:

namespace Jimmyt1988\PlatformGame\Helpers
{
}

How do i/Can i do this?

Was struggling to find anything in google

EDIT:

Considering this is a "duplicate" and was unfindable in google... I suggest you re-tag/name/whatever the "duplicate" entry.

Jimmyt1988
  • 20,466
  • 41
  • 133
  • 233
  • 1
    Stay unhappy and have three lines beginning with namespace and have the the three closing '}' –  Jan 27 '15 at 22:24
  • Goddddd dammitttt leeroyyyy. Thanks @DieterLücking – Jimmyt1988 Jan 27 '15 at 22:25
  • 2
    [This answer](http://stackoverflow.com/a/28022457/3014695) is what you're looking for. – pkrysiak Jan 27 '15 at 22:25
  • @pkrysiak - You have brought upon me depression and distaste :D ... C++17 – Jimmyt1988 Jan 27 '15 at 22:26
  • @Jimmyt1988 - c'mon, It's like only 2 years to go ;) – pkrysiak Jan 27 '15 at 22:27
  • I'm coding with Unreal engine, cross platform is apparently a big deal... and C++17 is not... going to cut it with their code base. Damn them, damn the world... arrrr... Thanks guys – Jimmyt1988 Jan 27 '15 at 22:28
  • 2
    "I suggest you re-tag/name/whatever the "duplicate" entry." — That's not how duplicates work. This question, marked as duplicate, *will stick around **exactly so that it provides more findability** for the other question*. – Kevin Reid Jan 27 '15 at 23:06

2 Answers2

2

Can i do this?

No. The closest you can get is

namespace Jimmyt1988{ namespace PlatformGame{ namespace Helpers

}}}
Drew Dormann
  • 59,987
  • 13
  • 123
  • 180
1

There is no abbreviated form in C++ for nested namespaces. I prefer one of the following depending on consistency:

namespace X
{
namespace Y
{
namespace Z
{
    // Avoid nesting too deep.

Or all on one line (slightly less clear but keeps a bunch of separate lines combined.

namespace X { namespace Y { namespace Z {
Mark B
  • 95,107
  • 10
  • 109
  • 188