title: C++ class static struct member definition
body: <p>I have not found a way to initialize the class member succesfully inside the constructor and I can not figure out why.</p>
  
  <p>I have a header file:</p>
  
  <pre><code>#pragma once
  
  struct STATE_MOUSE {
    bool moving;
    int left_button;
    int right_button;
    int middle_button;
    bool scroll_up;
    bool scroll_down;
  };
  
  class Message {
  private:
    static STATE_MOUSE state_mouse;
  public:
    Message();
    ~Message();
  };
  </code></pre>
  
  <p>Then I have a source file:</p>
  
  <pre><code>#include "message.hpp"
  
  STATE_MOUSE Message::state_mouse = {false, 0, 0, 0, false, false};
  
  Message::Message() {
    //Would like to initialize state_mouse here somehow.
  }
  
  Message::~Message() {
  
  }
  </code></pre>
  
  <p>Now to the issue. This set up seems to work. However I am used to initialize members inside a constructor and I have not found a way to do that with this static struct member.</p>
  
  <p>The following method does not work, could someone explain why?</p>
  
  <pre><code>state_mouse.moving = false;
  </code></pre>