glibmm: Glib::WeakRef< T_CppObject > Class Template Reference
WeakRef<> is a weak reference smartpointer. More...
#include <glibmm/weakref.h>
Public Member Functions |
|
WeakRef () noexcept | |
Default constructor.
More...
|
|
WeakRef (const WeakRef & src) noexcept | |
Copy constructor.
More...
|
|
WeakRef ( WeakRef && src) noexcept | |
Move constructor.
More...
|
|
template<typename T_CastFrom > | |
WeakRef (const WeakRef < T_CastFrom >& src) noexcept | |
Copy constructor from different, but castable type.
More...
|
|
template<typename T_CastFrom > | |
WeakRef ( WeakRef < T_CastFrom >&& src) noexcept | |
Move constructor from different, but castable type.
More...
|
|
template<typename T_CastFrom > | |
WeakRef (const RefPtr < T_CastFrom >& src) noexcept | |
Constructor from a
RefPtr
of the same or a castable type.
More...
|
|
~WeakRef () noexcept | |
Destructor.
More...
|
|
void | swap ( WeakRef & other) noexcept |
Swap the contents of two WeakRef<>.
More...
|
|
WeakRef & | operator= (const WeakRef & src) noexcept |
Copy assignment operator.
More...
|
|
WeakRef & | operator= ( WeakRef && src) noexcept |
Move assignment operator.
More...
|
|
template<typename T_CastFrom > | |
WeakRef & | operator= (const WeakRef < T_CastFrom >& src) noexcept |
Copy assignment from different, but castable type.
More...
|
|
template<typename T_CastFrom > | |
WeakRef & | operator= ( WeakRef < T_CastFrom >&& src) noexcept |
Move assignment from different, but castable type.
More...
|
|
template<typename T_CastFrom > | |
WeakRef & | operator= (const RefPtr < T_CastFrom >& src) noexcept |
Assignment from a
RefPtr
of the same or a castable type.
More...
|
|
operator bool () const noexcept | |
Test whether the WeakRef<> points to any underlying instance.
More...
|
|
RefPtr < T_CppObject > | get () const noexcept |
Create a strong reference to the underlying object.
More...
|
|
void | reset () noexcept |
Make this
WeakRef
empty.
More...
|
|
Static Public Member Functions |
|
template<typename T_CastFrom > | |
static WeakRef | cast_dynamic (const WeakRef < T_CastFrom >& src) noexcept |
Dynamic cast to derived class.
More...
|
|
template<typename T_CastFrom > | |
static WeakRef | cast_static (const WeakRef < T_CastFrom >& src) noexcept |
Static cast to derived class.
More...
|
|
template<typename T_CastFrom > | |
static WeakRef | cast_const (const WeakRef < T_CastFrom >& src) noexcept |
Cast to non-const.
More...
|
|
Related Functions |
|
(Note that these are not member functions.) |
|
template<class T_CppObject > | |
void | swap ( WeakRef < T_CppObject >& lhs, WeakRef < T_CppObject >& rhs) noexcept |
Swap the contents of two WeakRef<>.
More...
|
|
Detailed Description
template<typename T_CppObject>
class Glib::WeakRef< T_CppObject >
WeakRef<> is a weak reference smartpointer.
WeakRef can store a pointer to any class that is derived from Glib::ObjectBase , and whose reference() method is noexcept. In glibmm and gtkmm, that is anything derived from Glib::ObjectBase .
Unlike a RefPtr , a WeakRef does not contribute to the reference counting of the underlying object.
Constructor & Destructor Documentation
|
inline noexcept |
Default constructor.
Create an empty weak reference.
|
inline noexcept |
Copy constructor.
|
inline noexcept |
Move constructor.
|
inline noexcept |
Copy constructor from different, but castable type.
|
inline noexcept |
Move constructor from different, but castable type.
|
inline noexcept |
|
inline noexcept |
Destructor.
Member Function Documentation
|
inline static noexcept |
Cast to non-const.
The WeakRef can't be cast with the usual notation so instead you can use
|
inline static noexcept |
Dynamic cast to derived class.
The WeakRef can't be cast with the usual notation so instead you can use
|
inline static noexcept |
Static cast to derived class.
The WeakRef can't be cast with the usual notation so instead you can use
|
inline noexcept |
|
inline explicit noexcept |
Test whether the WeakRef<> points to any underlying instance.
Mimics usage of ordinary pointers:
In a multi-threaded program a
true
return value can become obsolete at any time, even before the caller has a chance to test it, because the underlying instance may lose its last reference in another thread. Use
get()
if this is not acceptable.
|
inline noexcept |
Copy assignment operator.
|
inline noexcept |
Move assignment operator.
|
inline noexcept |
Copy assignment from different, but castable type.
|
inline noexcept |
Move assignment from different, but castable type.
|
inline noexcept |
Assignment from a RefPtr of the same or a castable type.
|
inline noexcept |
Make this WeakRef empty.
|
inline noexcept |
Swap the contents of two WeakRef<>.