Skip to content

Latest commit

 

History

History
48 lines (36 loc) · 1.95 KB

File metadata and controls

48 lines (36 loc) · 1.95 KB
description title dev_langs ms.date ms.topic keywords ms.workload
A function template that wraps (or *boxes*) a scalar or array value inside a reference class object so that it can be passed to a function that expects **IInspectable**.
winrt::box_value function template (C++/WinRT)
C++
04/10/2018
reference
windows 10, uwp, standard, c++, cpp, winrt, projection, api, reference, box, boxing
cplusplus

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

Note

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

A function template that wraps (or boxes) a scalar or array value inside a reference class object so that it can be passed to a function that expects IInspectable. An overload of the function also exists for winrt::hstring. For more details, and code examples, see Boxing and unboxing values to IInspectable with C++/WinRT.

Syntax

winrt::Windows::Foundation::IInspectable box_value(winrt::hstring const& value);

template <typename T, typename = std::enable_if_t<!std::is_convertible_v<T, winrt::hstring>>>
winrt::Windows::Foundation::IInspectable box_value(T const& value);

Template parameters

typename T A scalar or array type.

Parameters

value A scalar or array value to box.

Return value

A reference class object containing the boxed value.

Requirements

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