Edit

winrt::detach_abi function (C++/WinRT)

A helper function that detaches a C++/WinRT object from its referenced handle, or from its referenced interface. Detaching from an interface is done without decrementing the reference count, perhaps to return it to a caller. For more info, and code examples, see Interop between C++/WinRT and the ABI.

Syntax

template >
&& !std::is_convertible_v>>
auto detach_abi(T&& object);

inline void* detach_abi(winrt::Windows::Foundation::IUnknown& object) noexcept;

inline void* detach_abi(winrt::Windows::Foundation::IUnknown&& object) noexcept;

constexpr void* detach_abi(std::nullptr_t) noexcept;

template 
void* detach_abi(winrt::com_ptr& object) noexcept;

inline void* detach_abi(winrt::hstring& object) noexcept;

inline void* detach_abi(winrt::hstring&& object) noexcept;

inline void* detach_abi(std::wstring_view const& value);

inline void* detach_abi(std::wchar_t const * const value);

template 
std::pair detach_abi(winrt::com_array& object) noexcept;

template 
std::pair detach_abi(winrt::com_array&& object) noexcept;

Parameters

object A C++/WinRT object to operate on.

Return value

The handle, or a pointer to the raw interface, referenced by the C++/WinRT object.

Requirements

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

Namespace: winrt

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

See also