title: C++ Member Reference base type 'int' is not a structure or union
body: <p>I'm running into a Problem in my C++ Code.</p>
  
  <p>I have a union <code>StateValue</code>:</p>
  
  <pre><code>union StateValue
  {
      int intValue;
      std::string value;
  };
  </code></pre>
  
  <p>and a struct <code>StateItem</code></p>
  
  <pre><code>struct StateItem
  {
      LampState state;
      StateValue value;
  };
  </code></pre>
  
  <p>I have a method which goes through a vector of type <code>StateItem</code></p>
  
  <pre><code>for(int i = 0; i &lt; stateItems.size(); i++)
  {
      StateItem &amp;st = stateItems[i];
      switch (st.state)
      {
          case Effect:
              result += std::string(", \"effect\": ") + st.value.value;
              break;
          case Hue:
              result += std::string(", \"hue\": ") + st.value.intValue.str();
              break;
          case On:
              result += std::string(", \"on\": ") + std::string(st.value.value);
              break;
          default:
              break;
      }
  }
  </code></pre>
  
  <p>In the case <code>Hue</code> I get the following Compiler error:</p>
  
  <pre>Member reference base type 'int' is not a structure or union</pre>
  
  <p>I can´t understand the problem here.
  Can anyone of you please help me?</p>