|
Bifrost SDK
Bifrost SDK documentation
|
Transient version of Amino::Ptr<T> which allows mutable access to the pointee. More...
#include <Ptr.h>
Public Types | |
| using | element_type = typename Base::element_type |
| The type of objects referenced by the Ptr pointer. More... | |
Public Member Functions | |
| MutablePtr (T *p) | |
Construct a mutable pointer that owns the object pointed by p. More... | |
| MutablePtr (MutablePtr &&) noexcept=default | |
| Move constructor. More... | |
| MutablePtr (MutablePtr const &) noexcept=delete | |
| MutablePtr are not copy constructible. More... | |
| template<class Y , class = if_convertible_from<Y>> | |
| MutablePtr (MutablePtr< Y > rhs) noexcept | |
| Move conversion construction from a MutablePtr of a compatible type Y. More... | |
| ~MutablePtr () | |
| Destructor. More... | |
| MutablePtr & | operator= (MutablePtr &&) noexcept=default |
| Move assignment. More... | |
| MutablePtr & | operator= (MutablePtr const &) noexcept=delete |
| MutablePtr are not copy assignable. More... | |
| template<class Y , class = if_convertible_from<Y>> | |
| MutablePtr & | operator= (MutablePtr< Y > rhs) noexcept |
| Move conversion assignment from a MutablePtr of a compatible type Y. More... | |
| operator bool () const | |
| Returns whether the pointer is non-null. More... | |
| void | reset () |
| Reset the pointer to an empty pointer. More... | |
| void | swap (MutablePtr &rhs) noexcept |
| Swap two pointers. More... | |
| Ptr< T > | toImmutable () noexcept |
| Conversion to a Ptr (immutable) More... | |
| template<class Y , class > | |
| MutablePtr< T > & | operator= (MutablePtr< Y > rhs) noexcept |
Empty constructors | |
| constexpr | MutablePtr () noexcept=default |
| Construct an empty MutablePtr. More... | |
| constexpr | MutablePtr (std::nullptr_t) noexcept |
| Construct an empty MutablePtr. More... | |
Accessors | |
Indirection.
| |
| T const & | operator* () const noexcept |
| Indirection. More... | |
| T & | operator* () noexcept |
| Indirection. More... | |
| T const * | operator-> () const noexcept |
| Indirection. More... | |
| T * | operator-> () noexcept |
| Indirection. More... | |
| T const * | get () const noexcept |
| Accessor. More... | |
| T * | get () noexcept |
| Indirection. More... | |
Friends | |
| template<typename Y > | |
| class | Ptr |
| Friendship to allow Ptr to call private constructor passing the control block. More... | |
| template<typename Y > | |
| class | MutablePtr |
| template<typename Y > | |
| class | PtrGuard |
Transient version of Amino::Ptr<T> which allows mutable access to the pointee.
This class is similar to a std::unique_ptr<T> in the sense that it has unique ownership over the pointee. But it's different than std::unique_ptr<T> because it still has a control block. It is meant to be used as a TRANSIENT type. It is not meant to be stored in a class or a struct. It is meant to be short-lived to allow mutation on the pointee, but then giving ownership back to a Ptr. (The control block is kept to avoid its unnecessary and inefficient deallocation/reallocation and to ensure that information captured before type-erasure is preserved).
Equivalently, an Amino::PtrGuard<T> can be used for more convenience and safety.
Similarly to std::unique_ptr, MutablePtr are not copy constructible nor copy assignable. They are default constructible, move constructible and move assignable.
| T | The type of objects referenced by the MutablePtr pointer. |
| using Amino::MutablePtr< T >::element_type = typename Base::element_type |
|
constexprdefaultnoexcept |
Construct an empty MutablePtr.
get() == nullptr
|
inlineconstexprnoexcept |
|
inline |
|
defaultnoexcept |
Move constructor.
|
deletenoexcept |
MutablePtr are not copy constructible.
|
inlinenoexcept |
Move conversion construction from a MutablePtr of a compatible type Y.
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineexplicit |
|
inlinenoexcept |
Indirection.
Definition at line 829 of file Ptr.h.
References Amino::Ptr< T >::get().
|
inlinenoexcept |
Indirection.
Definition at line 830 of file Ptr.h.
References Amino::Ptr< T >::get().
|
inlinenoexcept |
Indirection.
Definition at line 833 of file Ptr.h.
References Amino::Ptr< T >::get().
|
inlinenoexcept |
Indirection.
Definition at line 834 of file Ptr.h.
References Amino::Ptr< T >::get().
|
defaultnoexcept |
Move assignment.
|
deletenoexcept |
MutablePtr are not copy assignable.
|
noexcept |
Move conversion assignment from a MutablePtr of a compatible type Y.
|
inlinenoexcept |
|
inline |
Reset the pointer to an empty pointer.
This is equivalent to *this = Ptr().
get() == nullptr use_count() == 0
|
noexcept |
Swap two pointers.
Exchanges the contents of the two Ptr.
| [in] | rhs | the pointer to swap with |
Definition at line 1362 of file Ptr.h.
References Amino::swap().
|
noexcept |
Conversion to a Ptr (immutable)
This member function allows one to convert a MutablePtr<X> to a Ptr<X>. This effectively only transfer ownership of the pointee to the Ptr. No copy of the pointee is made.
get() == nullptrDefinition at line 1369 of file Ptr.h.
References Amino::Ptr< T >::swap().