winrt::check_bool function template (C++/WinRT)

A helper function that checks whether a value is false and, if so, calls the winrt::throw_last_error function to retrieve the calling thread's last-error code value, and throw an exception using a C++/WinRT object that represents that error code. Also see winrt::hresult_error.

Syntax

template<typename T>
void check_bool(T result);

Template parameters

typename T A type that's convertible to bool.

Parameters

result A value that's convertible to false (an error condition), or true (a success condition). An exception is thrown only if result is false.

Requirements

Minimum supported SDK: Windows SDK version 10.0.17134.0 (Windows 10, version 1803)

Namespace: winrt

Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\base.h (included by default)

See also