title: reinterpret_cast between std::unordered_map
body: <p>I have the following <code>unordered_map</code>s:</p>
  
  <pre><code> struct a{
          std::string b;
      };
  
      int main()
      {
          std::unordered_map&lt;std::string, std::string&gt; source;
          source["1"] = "Test";
          source["2"] = "Test2";
  
          std::unordered_map&lt;std::string, a&gt; dest = *reinterpret_cast&lt;std::unordered_map&lt;std::string, a&gt;*&gt;(&amp;source);
  
          std::cout &lt;&lt; dest["1"].b &lt;&lt; std::endl;
          std::cout &lt;&lt; dest["2"].b &lt;&lt; std::endl;
  
      }
  </code></pre>
  
  <p>Using a <code>reinterpret_cast</code> I convert <code>source</code> into <code>dest</code>. This works since <code>struct a</code> only consists of a <code>std::string</code>.</p>
  
  <p>My question: Is this actually good pratice? GCC yields the following warning: </p>
  
  <blockquote>
    <p>dereferencing type-punned pointer will break strict-aliasing rules</p>
  </blockquote>
  
  <p>Can I safely ignore this? Or is there any potential drawback of just casting the raw bytes of STL container?</p>
  
  <p>(<a href="http://cpp.sh/5r2rh" rel="nofollow noreferrer">cpp.sh/5r2rh</a>)</p>