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


You can unbox not only scalar values, but also most kinds of arrays (with the exception of arrays of enumerations) by using the winrt::unbox_value function.

A function template that unwraps (or unboxes) a scalar or array value from inside a reference class object so that it can be processed in a function that expects IInspectable. For more details, and code examples, see Boxing and unboxing values to IInspectable with C++/WinRT.


template <typename T>
T unbox_value(winrt::Windows::Foundation::IInspectable const& value);

Template parameters

typename T A scalar or array type.


value A reference class object containing a boxed value.

Return value

The scalar or array value contained inside the reference class object.


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

Namespace: winrt

Header: %WindowsSdkDir%Include<WindowsTargetPlatformVersion>\cppwinrt\winrt\Windows.Foundation.h

See also