Namespacing (static) member variables
<p>I would like to be able to achieve something like this:</p>

<pre><code>class Zot
{
    namespace A
    {
     static int x;
     static int y;
    }    
}
</code></pre>

<p>I am working with a legacy system that uses code generation heavily off a DB schema, and certain fields are exposed as methods/variables in the class definition.  I need to add a few extra static variables to these classes and would like to guarantee no clashes with the existing names.</p>

<p>The best I have come up with is to use another struct to wrap the statics as if it were a namespace:</p>

<pre><code>class Zot
{
    struct A
    {
     static int x;
     static int y;
    }    
}
</code></pre>

<p>Is there a better way?</p>

<p><strong>Update:</strong></p>

<p>An extra requirement is to be able to access these from a template elsewhere</p>

<p>e.g.</p>

<pre><code>template&lt;class T&gt;
class B
{
  void foo() { return T::A::x; }
};
</code></pre>

<p>So putting them in a separate class won't work</p>
