A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://learn.microsoft.com/en-us/uwp/cpp-ref-for-winrt/weak-ref below:

winrt::weak_ref struct template (C++/WinRT) - Windows UWP applications

A type representing a weak reference to a C++/WinRT object or interface. For more info, and code examples, see Strong and weak references in C++/WinRT.

Syntax
template <typename T>
struct weak_ref
Template parameters

typename T The type of C++/WinRT object or interface a weak reference to which is represented by the weak_ref object. This is the type of the weak reference's target.

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)

Constructors Member functions Function Description weak_ref::get function Increments the reference count, and retrieves the C++/WinRT object or interface weakly referenced by the weak_ref object. The way to determine whether or not a weak_ref can be resolved to a strong reference is to call get and try. Member operators Operator Description weak_ref::operator bool Checks whether the weak_ref object owns a weak reference or a nullptr. The way to determine whether or not a weak_ref can be resolved to a strong reference is to call weak_ref::get and try. weak_ref::weak_ref constructor

Initializes a new instance of the weak_ref struct, optionally with a copy of the input data.

Syntax
weak_ref(std::nullptr_t = nullptr) noexcept;
weak_ref(T const& object);
weak_ref(com_ptr<T> const& object);
Parameters

object A C++/WinRT object or interface or smart pointer that initializes the weak_ref object.

weak_ref::get function

Increments the reference count, and retrieves the C++/WinRT object or interface weakly referenced by the weak_ref object. The way to determine whether or not a weak_ref can be resolved to a strong reference is to call get and try.

Syntax
auto get() const noexcept;
Return value

The C++/WinRT object or interface weakly referenced by the weak_ref object, or nullptr if the weak reference's target has been destroyed.

weak_ref::operator bool

Checks whether the weak_ref object owns a weak reference or a nullptr. The way to determine whether or not a weak_ref can be resolved to a strong reference is to call weak_ref::get and try.

Syntax
explicit operator bool() const noexcept;
Return value

true if the weak_ref object owns a weak reference; false if the weak_ref object owns a nullptr.

See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4