title: Creating weak_ptr<> from raw pointer
body: <p>I'd like to wrap raw pointer member to some smart pointer to prevent deleting inside a developing class. Owner of the object under pointer is outside of class. So, looks like <code>boost::shared_ptr</code> and <code>std::auto_ptr</code> does not fit. The following is a reduced example:</p>
  
  <pre><code>class Foo {
    boost::weak_ptr&lt;Bar&gt; m_bar;
  public:
    void setBar(const Bar *bar) { // bar created on heap
      m_bar = bar;                // naturally compilation error
    }
  };
  </code></pre>
  
  <p>Of course, it induces compilation error. What is a correct way to initialize <code>weak_ptr</code> from a raw pointer (if exist)?</p>