title: Why shared_ptr<void> instead of shared_ptr<HANDLE>
body: <p>Based on <a href="http://en.highscore.de/cpp/boost/smartpointers.html#smartpointers_shared_pointer" rel="nofollow">http://en.highscore.de/cpp/boost/smartpointers.html#smartpointers_shared_pointer</a></p>
  
  <pre><code>#include &lt;boost/shared_ptr.hpp&gt; 
  #include &lt;windows.h&gt; 
  
  int main() 
  { 
    boost::shared_ptr&lt;void&gt; h(OpenProcess(PROCESS_SET_INFORMATION, FALSE, 
                    GetCurrentProcessId()), CloseHandle); 
    SetPriorityClass(h.get(), HIGH_PRIORITY_CLASS); 
  }
  </code></pre>
  
  <p><strong>Question</strong>:</p>
  
  <p>Why the <code>h</code> is defined as <code>boost::shared_ptr&lt;void&gt;</code> rather than <code>boost::shared_ptr&lt;HANDLE&gt;</code>?</p>
  
  <p>FYI:</p>
  
  <pre><code>WINBASEAPI
  HANDLE
  WINAPI
  OpenProcess(
      __in DWORD dwDesiredAccess,
      __in BOOL bInheritHandle,
      __in DWORD dwProcessId
      );
  
  typedef void * HANDLE;
  </code></pre>
  
  <p><a href="http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/sp_techniques.html#pvoid" rel="nofollow">http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/sp_techniques.html#pvoid</a></p>