title: How to initialise a std::map once so that it can be used by all objects of a class?
body: <p>I have an enum StackIndex defined as follows:</p>
  
  <pre><code>typedef enum 
  {
      DECK,
      HAND,
      CASCADE1,
      ...
      NO_SUCH_STACK
  } StackIndex;
  </code></pre>
  
  <p>I have created a class called <code>MoveSequence</code>, which is a wrapper for a <code>std::deque</code> of a bunch of tuples of the form <code>&lt;StackIndex, StackIndex&gt;</code>.</p>
  
  <pre><code>class MoveSequence
  {
      public:
          void AddMove( const tpl_move &amp; move ){ _m_deque.push_back( move ); }
          void Print();
      protected:
      deque&lt;tpl_move&gt; _m_deque;
  };
  </code></pre>
  
  <p>I thought I could create a static <code>std::map</code> member of the <code>MoveSequence</code> class, which would translate a <code>StackIndex</code> to a <code>std::string</code>, for use by the <code>Print()</code> function. But when I tried, I got the error:</p>
  
  <pre><code>"error C2864: 'MoveSequence::m' : only static const integral data members can be initialized within a class"
  </code></pre>
  
  <p>If its not possible to created a std::map as a static member, is there another way to create a std::map that translates a <code>StackIndex</code> to a <code>std::string</code> that can be used to print out <code>MoveSequence</code> objects?</p>
  
  <p>thanks</p>
  
  <p>Beeband.</p>