Skip to content

Instantly share code, notes, and snippets.

View kirillkovalenko's full-sized avatar

Kyrylo Kovalenko kirillkovalenko

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kirillkovalenko on github.
  • I am kovalenko (https://keybase.io/kovalenko) on keybase.
  • I have a public key ASBmMT6M_fp1VRmATFClHNEWoaTDEGbMJWxZqtDNBl1iaAo

To claim this, I am signing this object:

// http://stackoverflow.com/questions/31651925/using-unique-ptr-shared-ptr-with-api-functions-returning-resources-as-out-para
template<typename P, typename T = typename P::element_type>
class outptr
{
T* _p; P& _sp;
public:
outptr(P& sp) throw() : _p(nullptr), _sp(sp) { }
~outptr() throw() { _sp.reset(_p); }
T** operator&() throw() { return &_p; }
//-----------------------------------------------------------------------------
// This header file was assembled from MSDN content.
//
// Jeff Fitzsimons, 9/2008.
//-----------------------------------------------------------------------------
#include <windows.h>
#include <wincrypt.h>
//-----------------------------------------------------------------------------