title: Could weak_ptr from make_shared be implemented with a single pointer instead of two?
body: <p>The size of a shared_ptr is the size of two raw pointers, one to the resource and another to the control block that keeps reference counts. Ordinarily the control block is allocated separately from the resource but with make_shared it's likely that the control block is allocated with the resource, I'm (guessing) something like:</p>
  <pre><code>template &lt;typename T&gt;
  struct ResourceAndControlBlock
  {
  struct ControlBlock{
        int weakReferences, strongReferences;
  }controlBlock;    
  char obj[sizeof(T)]; // Object can exist here or not
      
  };
  </code></pre>
  <p>And when you do make_shared{} it returns a shared_ptr, which contains two pointers, one to char obj[] (the resource), and one to 'controlBlock'.</p>
  <p>I was wondering whether it could be implemented in this way, make_shared returns a shared pointer with only one pointer, to the resource, and then when needing to access the information in the control block, to check if the resource is still valid, or to decrement any references, it can access it with the 'resource pointer' minus sizeof(ControlBlock).</p>
  <p>Is the reason why this is a bad idea just that it complicates things having two different types of shared pointers, one with two pointers and one with only one? Or is there something wrong with doing it this way?</p>
  <p>Edit: I just remembered about the strict aliasing rule, is it that the pointer to resource can't be cast to a ControlBlock pointer to read the control block?</p>