|
| constexpr | UnownedPointer () noexcept=default |
| | Constructor for an empty pointer.
|
| |
| constexpr | UnownedPointer (const UnownedPointer &) noexcept=default |
| | Copy constructor.
|
| |
template<typename RelatedElement , typename RelatedDeleter >
requires std::is_constructible_v<std::unique_ptr<Element, Deleter>, std::unique_ptr<RelatedElement, RelatedDeleter> &&> |
| constexpr | UnownedPointer (const UnownedPointer< RelatedElement, RelatedDeleter > &value) noexcept |
| | Constructor that sets the value from a related pointer.
|
| |
| constexpr | UnownedPointer (const std::unique_ptr< Element, Deleter > &value) noexcept |
| | Constructor that sets the value from an std::unique_ptr.
|
| |
template<typename RelatedElement , typename RelatedDeleter >
requires std::is_constructible_v<std::unique_ptr<Element, Deleter>, std::unique_ptr<RelatedElement, RelatedDeleter> &&> |
| constexpr | UnownedPointer (const std::unique_ptr< RelatedElement, RelatedDeleter > &value) noexcept |
| | Constructor that sets the value from a related std::unique_ptr.
|
| |
| constexpr | UnownedPointer (pointer value) noexcept |
| | Constructor that sets the value from a raw pointer.
|
| |
| constexpr | UnownedPointer (std::nullptr_t) noexcept |
| | Constructor that sets the value to an empty pointer.
|
| |
| constexpr auto | operator= (const UnownedPointer &) noexcept -> UnownedPointer &=default |
| | Assignment operator.
|
| |
template<typename RelatedElement , typename RelatedDeleter >
requires std::is_constructible_v<std::unique_ptr<Element, Deleter>, std::unique_ptr<RelatedElement, RelatedDeleter> &&> |
| constexpr auto | operator= (const UnownedPointer< RelatedElement, RelatedDeleter > &value) noexcept -> UnownedPointer & |
| | Assignment operator that sets the value from a related pointer.
|
| |
| constexpr auto | operator= (const std::unique_ptr< Element, Deleter > &value) noexcept -> UnownedPointer & |
| | Assignment operator that sets the value from an std::unique_ptr.
|
| |
template<typename RelatedElement , typename RelatedDeleter >
requires std::is_constructible_v<std::unique_ptr<Element, Deleter>, std::unique_ptr<RelatedElement, RelatedDeleter> &&> |
| constexpr auto | operator= (const std::unique_ptr< RelatedElement, RelatedDeleter > &value) noexcept -> UnownedPointer & |
| | Assignment operator that sets the value from a related std::unique_ptr.
|
| |
| constexpr auto | operator= (std::nullptr_t) noexcept -> UnownedPointer & |
| | Assignment operator that sets the value to an empty pointer.
|
| |
| auto | operator* () const noexcept(noexcept(*std::declval< pointer >())) -> typename std::add_lvalue_reference_t< Element > |
| | Access to the pointed-to object.
|
| |
| auto | operator-> () const noexcept -> pointer |
| | Access to members of the pointed-to object.
|
| |
| | operator bool () const noexcept |
| | Checks whether the value is non-empty.
|
| |
| auto | get () const noexcept -> pointer |
| | Gets the current value.
|
| |
| auto | reset (pointer value=pointer()) noexcept -> void |
| | Sets a new value.
|
| |
| auto | swap (UnownedPointer &other) noexcept -> void |
| | Swaps the value with another unowned pointer.
|
| |
|
(Note that these are not member symbols.)
|
| template<typename LhsElement , typename LhsDeleter , typename RhsElement , typename RhsDeleter > |
| constexpr auto | operator== (const UnownedPointer< LhsElement, LhsDeleter > &lhs, const UnownedPointer< RhsElement, RhsDeleter > &rhs) -> bool |
| | Comparison between two unowned pointers.
|
| |
| template<typename LhsElement , typename LhsDeleter , typename RhsElement , typename RhsDeleter > |
| constexpr auto | operator== (const UnownedPointer< LhsElement, LhsDeleter > &lhs, const std::unique_ptr< RhsElement, RhsDeleter > &rhs) -> bool |
| | Comparison between an unowned pointer and an std::unique_ptr.
|
| |
| template<typename Element , typename Deleter > |
| constexpr auto | operator== (const UnownedPointer< Element, Deleter > &lhs, std::nullptr_t) -> bool |
| | Comparison between an unowned pointer and a null pointer.
|
| |
| template<typename LhsElement , typename LhsDeleter , typename RhsElement , typename RhsDeleter > |
| constexpr auto | operator (const UnownedPointer< LhsElement, LhsDeleter > &lhs, const UnownedPointer< RhsElement, RhsDeleter > &rhs) -> auto |
| | Tree-way comparison between two unowned pointers.
|
| |
| template<typename LhsElement , typename LhsDeleter , typename RhsElement , typename RhsDeleter > |
| constexpr auto | operator (const UnownedPointer< LhsElement, LhsDeleter > &lhs, const std::unique_ptr< RhsElement, RhsDeleter > &rhs) -> auto |
| | Tree-way comparison between an unowned pointer and an std::unique_ptr.
|
| |
| template<typename Element , typename Deleter > |
| constexpr auto | operator (const UnownedPointer< Element, Deleter > &lhs, std::nullptr_t) -> auto |
| | Tree-way comparison between an unowned pointer and a null pointer.
|
| |
| template<typename Character , typename Traits , typename Element , typename Deleter > |
| auto | operator<< (std::basic_ostream< Character, Traits > &stream, const UnownedPointer< Element, Deleter > &pointer) -> std::basic_ostream< Character, Traits > & |
| | Stream insertion operator.
|
| |
| template<typename Element , typename Deleter > |
| auto | swap (UnownedPointer< Element, Deleter > &lhs, UnownedPointer< Element, Deleter > &rhs) noexcept -> void |
| | Swaps two unowned pointers.
|
| |
template<typename Element, typename Deleter = std::default_delete<Element>>
class xentara::utils::tools::UnownedPointer< Element, Deleter >
A non-owning pointer that is interface compatible with std::unique_ptr.
This class wraps a regular pointer into an object whose interface is (mostly) compatible with std::unique_ptr. It can be used in situations where an object is not owned by the pointer, but using a raw Element * is not desirable. This class is used as the return type of atomic::UniquePointer::load(), for example.
- Template Parameters
-
| Element | The element the pointer holds |
| Deleter | The deleter used by the compatible std::unique_ptr. This class only used the deleter to determine the correct type for the pointer and element_type type aliases. |