title: typedef'ing an enum does not make the enum-values visible
body: <p>I have a class in which I have an enumeration, defined like this:</p>
  
  <pre><code>class X
     {
     public:
        enum Direction {DIR_LEFT, DIR_RIGHT};
     };
  </code></pre>
  
  <p>Now I want this enumeration to be reused in another class, like this:</p>
  
  <pre><code>class Y
     {
     public:
        typedef X::Direction Direction;
     };
  </code></pre>
  
  <p>As expected, using Y::Direction works correctly, e.g.:</p>
  
  <pre><code>void myFunction (Y::Direction dir)
  {
  }
  </code></pre>
  
  <p>But the values within the enumeration does not seem to be 'copied' together with the typedef.  If I write the following, I get compilation errors:</p>
  
  <pre><code>myFunction (Y::DIR_LEFT);
  </code></pre>
  
  <p>Instead, I have to refer to the original place of the enumeration again, like this:</p>
  
  <pre><code>myFunction (X::DIR_LEFT);
  </code></pre>
  
  <p>Which defeats my purpose of typdefing the enumeration.</p>
  
  <p>The only solution I see is to move the enumeration out of class X, and putting it in another class (e.g. MyEnums), so it can be reused by X and Y (although they should still use MyEnums::DIR_LEFT and MyEnums::DIR_RIGHT), but at least the code does not depend on class X anymore.</p>
  
  <p>Why are the enumeration values itself no exposed via the typedef?</p>
  
  <p>Are there any other patterns to manage enumerations in different classes?</p>