title: Managing trivial types
body: <p>I have found the intricacies of trivial types in C++ non-trivial to understand and hope someone can enlighten me on the following.</p>
  
  <p>Given type <code>T</code>, storage for <code>T</code> allocated using <code>::operator new(std::size_t)</code> or <code>::operator new[](std::size_t)</code> or <code>std::aligned_storage</code>, and a <code>void * p</code> pointing to a location in that storage suitably aligned for <code>T</code> so that it may be constructed at <code>p</code>:</p>
  
  <ol>
  <li>If <code>std::is_trivially_default_constructible&lt;T&gt;::value</code> holds, is the code invoking undefined behavior when code skips initialization of <code>T</code> at <code>p</code> (i.e. by using <code>T * tPtr = new (p) T();</code>) before otherwise accessing <code>*p</code> as <code>T</code>? Can one just use <code>T * tPtr = static_cast&lt;T *&gt;(p);</code> instead without fear of undefined behavior in this case?</li>
  <li>If <code>std::is_trivially_destructible&lt;T&gt;::value</code> holds, does skipping destruction of <code>T</code> at <code>*p</code> (i.e by calling <code>tPtr-&gt;~T();</code>) cause undefined behavior?</li>
  <li>For any type <code>U</code> for which <code>std::is_trivially_assignable&lt;T, U&gt;::value</code> holds, is <code>std::memcpy(&amp;t, &amp;u, sizeof(U));</code> equivalent to <code>t = std::forward&lt;U&gt;(u);</code> (for any <code>t</code> of type <code>T</code> and <code>u</code> of type <code>U</code>) or will it cause undefined behavior?</li>
  </ol>