title: Getting shared_ptr to call a member function once its reference count reaches 0
body: <p>I'm creating a wrapper for a HANDLE that does not work with DuplicateHandle, so instead I am trying to wrap the handle in a shared_ptr.</p>
  
  <p>Imagine the following code:</p>
  
  <pre><code>class CWrapper
  {
  public:
      CWrapper() :
          m_pHandle(new HANDLE, &amp;CWrapper::Close)
      {
          //code to open handle
      }
  
  private:
      void Close() 
      { 
          //code to close handle
      }
  
      std::shared_ptr&lt;HANDLE&gt; m_pHandle;
  }
  </code></pre>
  
  <p>I have also tried creating close with a HANDLE parameter (not ideal).  Either way, I get the compiler error "Term does not evaluate to a function taking 0 arguments".  Is this because of the implicit this pointer?  How do I fix this?  How do I call a member function from the shared pointer?</p>