title: Why does enable_shared_from_this embed a weak pointer instead of embedding the reference counter directly?
body: <p>The <code>enable_shared_from_this</code> helper contains a weak pointer that is set when creating shared pointer to the object. That means there is the reference-count (allocated separately or together with the object using <code>make_shared</code>) and an extra <code>weak_ptr</code> in the object.</p>
  
  <p>Now why doesn't it simply contain the reference count instead? When setting <code>shared_ptr</code> from dumb pointer, the type has to be fully defined, so the <code>shared_ptr</code> constructor or assignment operator can detect the type is derived from <code>enable_shared_from_this</code> and use the correct counter and the format can remain the same, so copying does not care. In fact, the <code>shared_ptr</code> already has to detect it to set the embedded <code>weak_ptr</code>.</p>