title: C++ why raw pointer won't increase reference count of shared_ptr?
body: <p>the <code>shared_ptr</code> use reference count to determine when to destroy the object. 
  And pls look at this code:</p>
  
  <pre><code>int main() {
      std::shared_ptr&lt;int&gt; pt = std::make_shared&lt;int&gt;(3);
      int *pt2 = pt.get();
      cout &lt;&lt; "reference count " &lt;&lt; pt.use_count() &lt;&lt; endl;
      pt = 0;
      cout &lt;&lt; *pt2;
  
  };
  </code></pre>
  
  <p>after I set pt to 0, the reference count should become 0, and the object should be destroyed. But I can still use pt2 to access it. In my case, the result is correct, but I guess it's just luck. So does it mean that the reference count mechanism still can not make it 100% safe if the programmer want to do some stupid thing?</p>