Skip to content

Instantly share code, notes, and snippets.

@zao
Created August 9, 2011 06:45
Show Gist options
  • Save zao/1133521 to your computer and use it in GitHub Desktop.
Save zao/1133521 to your computer and use it in GitHub Desktop.
Asserting HRESULT-like
struct noisy_hresult
{
HRESULT hr;
noisy_hresult& operator = (HRESULT hr)
{
this->hr = hr;
if (FAILED(hr))
__debugbreak();
return *this;
}
operator HRESULT () const { return hr; }
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment