MySQL 8.0.40
Source Code Documentation
|
Class that holds the pointer to a variable in a static and non-destructible way. More...
#include <ref_ptr.h>
Public Member Functions | |
Ref_ptr ()=default | |
Default class constructor. More... | |
Ref_ptr (T &target) | |
Class constructor that receives the reference to be managed. More... | |
Ref_ptr (Ref_ptr< T > const &rhs) | |
Copy constructor. More... | |
Ref_ptr (Ref_ptr< T > &&rhs) | |
Move constructor. More... | |
virtual | ~Ref_ptr ()=default |
Default destructor. More... | |
Ref_ptr< T > & | operator= (T &rhs) |
Assignment operator to instantiate the reference to be managed. More... | |
Ref_ptr< T > & | operator= (Ref_ptr< T > const &rhs) |
Copy operator. More... | |
Ref_ptr< T > & | operator= (Ref_ptr< T > &&rhs) |
Move operator. More... | |
bool | operator! () const |
Negation operator. More... | |
T * | operator-> () const |
Arrow operator to access the underlying object of type T . More... | |
T & | operator* () const |
Star operator to access the underlying object of type T . More... | |
Ref_ptr< T > & | reset () |
Resets the managed reference and stops managing any pointer. More... | |
bool | operator== (std::nullptr_t rhs) const |
Equality to nullptr operator. More... | |
bool | operator!= (std::nullptr_t rhs) const |
Inequality to nullptr operator. More... | |
template<typename R > | |
bool | operator== (memory::Ref_ptr< R > const &rhs) const |
Equality operator. More... | |
template<typename R > | |
bool | operator!= (memory::Ref_ptr< R > const &rhs) const |
Inequality operator. More... | |
Private Attributes | |
T * | m_underlying {nullptr} |
The reference to be managed. More... | |
Class that holds the pointer to a variable in a static and non-destructible way.
The purpose is both to clearly state the ownership of the memory being pointed to and to avoid unwanted pointer operations (a delete
on a pointer pointing to a stack memory block, for instance).
It's a convenience class for clearly stating the ownership of the underlying pointer and is used for interface and code clarity.
|
default |
Default class constructor.
memory::Ref_ptr< T >::Ref_ptr | ( | T & | target | ) |
Class constructor that receives the reference to be managed.
target | The reference to be managed. |
memory::Ref_ptr< T >::Ref_ptr | ( | memory::Ref_ptr< T > const & | rhs | ) |
Copy constructor.
rhs | The object to copy from. |
memory::Ref_ptr< T >::Ref_ptr | ( | memory::Ref_ptr< T > && | rhs | ) |
Move constructor.
rhs | The object to move from. |
|
virtualdefault |
Default destructor.
bool memory::Ref_ptr< T >::operator! |
Negation operator.
true
if there is no managed reference, false
otherwise. bool memory::Ref_ptr< T >::operator!= | ( | memory::Ref_ptr< R > const & | rhs | ) | const |
Inequality operator.
rhs | The object to compare to. |
true
if the managed reference is not the same as one managed by the rhs
object. bool memory::Ref_ptr< T >::operator!= | ( | std::nullptr_t | rhs | ) | const |
Inequality to nullptr
operator.
rhs | nullptr value |
false
if the managed reference is not instantiated. T & memory::Ref_ptr< T >::operator* |
Star operator to access the underlying object of type T
.
T
. T * memory::Ref_ptr< T >::operator-> |
Arrow operator to access the underlying object of type T
.
T
. memory::Ref_ptr< T > & memory::Ref_ptr< T >::operator= | ( | memory::Ref_ptr< T > && | rhs | ) |
Move operator.
rhs | The object to move from. |
this
object. memory::Ref_ptr< T > & memory::Ref_ptr< T >::operator= | ( | memory::Ref_ptr< T > const & | rhs | ) |
Copy operator.
rhs | The object to copy from. |
this
object. memory::Ref_ptr< T > & memory::Ref_ptr< T >::operator= | ( | T & | rhs | ) |
Assignment operator to instantiate the reference to be managed.
rhs | The reference to be managed. |
this
object. bool memory::Ref_ptr< T >::operator== | ( | memory::Ref_ptr< R > const & | rhs | ) | const |
Equality operator.
rhs | The object to compare to. |
true
if the managed reference is the same as one managed by the rhs
object. bool memory::Ref_ptr< T >::operator== | ( | std::nullptr_t | rhs | ) | const |
Equality to nullptr
operator.
rhs | nullptr value |
true
if the managed reference is not instantiated. memory::Ref_ptr< T > & memory::Ref_ptr< T >::reset | ( | void | ) |
Resets the managed reference and stops managing any pointer.
this
object, for chaining purposes.
|
private |
The reference to be managed.