EventAnalysis
1.3.0
|
A smart pointer not owning the wrapped object. More...
#include <ObserverPtr.h>
Public Member Functions | |
observer_ptr () | |
Default constructor. More... | |
observer_ptr (std::nullptr_t) | |
Null constructor. More... | |
template<typename W > | |
observer_ptr (const observer_ptr< W > p) | |
Copy constructor. More... | |
template<typename W > | |
observer_ptr & | operator= (const observer_ptr< W > &p) |
Assignment operator. More... | |
template<typename W > | |
observer_ptr (W *p) | |
Constructor from raw pointer. More... | |
template<typename W > | |
observer_ptr & | operator= (W *p) |
Assignment operator from raw pointer. More... | |
template<typename W > | |
observer_ptr (const std::unique_ptr< W > &p) | |
Constructor from std::unique_ptr. More... | |
template<typename W > | |
observer_ptr & | operator= (const std::unique_ptr< W > &p) |
Assignment operator from std::unique_ptr. More... | |
template<typename W > | |
observer_ptr (const std::shared_ptr< W > p) | |
Constructor from std::shared_ptr. More... | |
template<typename W > | |
observer_ptr & | operator= (const std::shared_ptr< W > &p) |
Assignment operator from std::shared_ptr. More... | |
operator bool () const | |
Conversion to boolean. More... | |
operator int () const =delete | |
template<typename W > | |
operator W* () | |
Conversion to raw pointer. More... | |
T * | get () const |
Getter for pointed address. More... | |
T * | operator-> () const |
Arrow operator. More... | |
T & | operator* () const |
Indirection operator. More... | |
Private Attributes | |
T * | _ptr |
Comparison with observer_ptr. More... | |
A smart pointer not owning the wrapped object.
This class is a simple smart pointer inspired by the std::observer_ptr class which will be part of the C++17 standard. This implementation is meant to be used as long as the C++17 standard is not available or not required for this project.
|
inline |
Default constructor.
Builds an observer_ptr pointing to nullptr.
|
inline |
|
inline |
Copy constructor.
p | The observer_ptr to be copied. |
Constructor from raw pointer.
Builds an observer_ptr pointing to address passed as argument. The template argument type W must either exactly match the type T or be a child class of T.
p | Raw pointer to be wrapped. |
|
inline |
Constructor from std::unique_ptr.
Builds an observer_ptr pointing to the same object pointed by #p. The template argument type W must either exactly match the type T or be a child class of T.
p | Raw pointer to be wrapped. |
|
inline |
Constructor from std::shared_ptr.
Builds an observer_ptr pointing to the same object pointed by #p. The template argument type W must either exactly match the type T or be a child class of T.
p | std::shared_ptr pointing to the desired object. |
|
inline |
Getter for pointed address.
|
inline |
Conversion to boolean.
|
delete |
Conversion to raw pointer.
The template argument type W must either exactly match the type T or be a child class of T.
|
inline |
Indirection operator.
|
inline |
Arrow operator.
|
inline |
|
inline |
Assignment operator from raw pointer.
The wrapped pointer is set to the given argument. The template argument type W must either exactly match the type T or be a child class of T.
p | The lhs raw pointer. |
|
inline |
Assignment operator from std::unique_ptr.
Makes the observer_ptr point to the same object pointed by #p. The template argument type W must either exactly match the type T or be a child class of T.
p | The lhs std::unique_ptr. |
|
inline |
Assignment operator from std::shared_ptr.
Makes the observer_ptr point to the same object pointed by #p. The template argument type W must either exactly match the type T or be a child class of T.
p | The lhs std::shared_ptr. |
|
private |
Comparison with observer_ptr.
The template argument type W must either exactly match the type T or be a child class of T.
p | The lhs observer_ptr. |
Comparison with raw pointer.
The template argument type W must either exactly match the type T or be a child class of T.
p | The lhs observer_ptr. |
Comparison with std::unique_ptr.
The template argument type W must either exactly match the type T or be a child class of T.
p | The lhs std::unique_ptr. |
Comparison with std::shared_ptr.
The template argument type W must either exactly match the type T or be a child class of T.
p | The lhs std::shared_ptr. |