winrt::d etach_abi 函式 (C++/WinRT)

協助程式函式,會將 C++/WinRT 物件與其參考的控制碼或其參考的介面中斷連結。 從介面中斷連結時,不會遞減參考計數,或許可以將其傳回給呼叫端。 如需詳細資訊和程式碼範例,請參閱 C++/WinRT 與 ABI 之間的 Interop

語法

template <typename T, typename =
std::enable_if_t<!std::is_base_of_v<winrt::Windows::Foundation::IUnknown, std::decay_t<T>>
&& !std::is_convertible_v<T, std::wstring_view>>>
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 <typename T>
void* detach_abi(winrt::com_ptr<T>& 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 <typename T>
std::pair<uint32_t, void*> detach_abi(winrt::com_array<T>& object) noexcept;

template <typename T>
std::pair<uint32_t, void*> detach_abi(winrt::com_array<T>&& object) noexcept;

參數

object 要運作的 C++/WinRT 物件。

傳回值

C++/WinRT 物件所參考之原始介面的控制碼或指標。

規格需求

最低支援的 SDK:Windows SDK 10.0.17134.0 版 (Windows 10版本 1803)

命名空間: winrt

標頭: %WindowsSdkDir%IncludeWindowsTargetPlatformVersion <> \cppwinrt\winrt\base. (h 預設包含)

另請參閱