![]() |
Arene Base
Fundamental Utilities For Safety Critical C++
|
A non-owning, nullable pointer with nullptr checks on dereference. More...

Public Types | |
| using | element_type = T |
| The type of the element pointed to. | |
| using | pointer = T* |
The type of a pointer to T. | |
| using | reference = T& |
The type of a reference to T. | |
Public Member Functions | |
| constexpr | non_owning_ptr () noexcept=default |
| Default, trivial constructor. | |
| template<typename U = element_type, constraints< std::enable_if_t< std::is_convertible< typename non_owning_ptr< U >::pointer, pointer >::value > > = nullptr> | |
| constexpr | non_owning_ptr (non_owning_ptr< U > new_ptr) noexcept |
| Constructor from non_owning_ptr convertible to the held type. | |
| constexpr | non_owning_ptr (pointer new_ptr) noexcept |
| Constructor from a pointer to T. | |
| constexpr | non_owning_ptr (std::nullptr_t) noexcept |
| Constructor from nullptr. | |
| template<typename U = pointer, constraints< std::enable_if_t< std::is_pointer< U >::value >, std::enable_if_t< std::is_convertible< U, pointer >::value > > = nullptr> | |
| constexpr | non_owning_ptr (U new_ptr) noexcept |
| Constructor from a raw pointer convertible to the held type. | |
| ARENE_NODISCARD constexpr auto | get () const noexcept -> pointer |
| Accesses the held pointer directly. | |
| ARENE_NODISCARD constexpr | operator bool () const noexcept |
| Conversion to bool. | |
| template<typename U, constraints< std::enable_if_t<!is_non_owning_ptr_v< U > >, std::enable_if_t< std::is_convertible< pointer, U >::value > > = nullptr> | |
| constexpr | operator U () const noexcept |
| Conversion operator to pointer-like type. | |
| ARENE_NODISCARD constexpr auto | operator! () const noexcept -> bool |
| Boolean negation operator. | |
| ARENE_NODISCARD constexpr auto | operator* () const noexcept -> reference |
| Dereference operator. | |
| ARENE_NODISCARD constexpr auto | operator-> () const noexcept -> pointer |
| Arrow operator. | |
| template<typename U = pointer, constraints< std::enable_if_t< std::is_pointer< U >::value >, std::enable_if_t< std::is_convertible< U, pointer >::value > > = nullptr> | |
| constexpr void | reset (U new_ptr=nullptr) |
| Resets the held pointer to a new value. | |
| template<typename I> | |
| constexpr auto | operator[] (I)=delete |
| Pointer arithmetic is explicitly deleted. | |
| template<typename I> | |
| constexpr auto | operator[] (I) const =delete |
| Pointer arithmetic is explicitly deleted. | |
| template<typename I> | |
| constexpr auto | operator+ (I const &) const -> non_owning_ptr=delete |
| Pointer arithmetic is explicitly deleted. | |
| template<typename I> | |
| constexpr auto | operator- (I const &) const -> non_owning_ptr=delete |
| Pointer arithmetic is explicitly deleted. | |
| constexpr auto | operator++ () -> non_owning_ptr &=delete |
| Pointer arithmetic is explicitly deleted. | |
| constexpr auto | operator++ (int) -> non_owning_ptr &=delete |
| Pointer arithmetic is explicitly deleted. | |
| constexpr auto | operator-- () -> non_owning_ptr &=delete |
| Pointer arithmetic is explicitly deleted. | |
| constexpr auto | operator-- (int) -> non_owning_ptr &=delete |
| Pointer arithmetic is explicitly deleted. | |
Friends | |
| ARENE_NODISCARD friend constexpr auto | operator== (non_owning_ptr const &lhs, non_owning_ptr const &rhs) noexcept -> bool |
| 6-way comparison is equivalent to comparing raw pointers. | |
| ARENE_NODISCARD friend constexpr auto | operator< (non_owning_ptr const &lhs, non_owning_ptr const &rhs) noexcept -> bool |
| 6-way comparison is equivalent to comparing raw pointers. | |
Friends inherited from arene::base::full_equality_operators_from_basic_equality< Derived, Other > | |
A non-owning, nullable pointer with nullptr checks on dereference.
| T | The type pointed to by the pointer. |
A non_owning_ptr<T> models T* with the following differences:
non_owning_ptr<T> has defined behavior: an ARENE_PRECONDITION violation.delete 'ing the held object through the non_owning_ptr is unsupported. | using arene::base::non_owning_ptr< T >::element_type = T |
The type of the element pointed to.
| using arene::base::non_owning_ptr< T >::pointer = T* |
The type of a pointer to T.
| using arene::base::non_owning_ptr< T >::reference = T& |
The type of a reference to T.
|
constexprdefaultnoexcept |
Default, trivial constructor.
get() will return nullptr, otherwise the state is undefined.
|
inlineconstexprnoexcept |
Constructor from nullptr.
get() returns nullptr.
|
inlineconstexprnoexcept |
Constructor from a pointer to T.
| new_ptr | The pointer to hold. |
get() returns new_ptr
|
inlineconstexprnoexcept |
Constructor from non_owning_ptr convertible to the held type.
| U | the element type of the non_owning_ptr to convert from. Must be pointer-convertible to pointer. |
| new_ptr | The pointer to hold. |
get() returns new_ptr converted to pointer.
|
inlineconstexprnoexcept |
Constructor from a raw pointer convertible to the held type.
| U | the pointer type to convert from. Must be convertible to pointer . |
| new_ptr | The pointer to hold. |
get() returns new_ptr converted to pointer .
|
inlineconstexprnoexcept |
Accesses the held pointer directly.
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
Conversion operator to pointer-like type.
| U | the type to convert to. Must be convertible from pointer . |
U
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
Dereference operator.
get() != nullptr, otherwise an ARENE_PRECONDITION violation.
|
constexprdelete |
Pointer arithmetic is explicitly deleted.
|
constexprdelete |
Pointer arithmetic is explicitly deleted.
|
constexprdelete |
Pointer arithmetic is explicitly deleted.
|
constexprdelete |
Pointer arithmetic is explicitly deleted.
|
constexprdelete |
Pointer arithmetic is explicitly deleted.
|
constexprdelete |
Pointer arithmetic is explicitly deleted.
|
inlineconstexprnoexcept |
Arrow operator.
get() != nullptr, otherwise an ARENE_PRECONDITION violation.
|
constexprdelete |
Pointer arithmetic is explicitly deleted.
|
constexprdelete |
Pointer arithmetic is explicitly deleted.
|
inlineconstexpr |
Resets the held pointer to a new value.
| U | the pointer type to convert from. Must be convertible to pointer . |
| new_ptr | The pointer to reset from. Defaults to nullptr. |
get() returns new_ptr converted to pointer .
|
friend |
6-way comparison is equivalent to comparing raw pointers.
| lhs | The first value to compare |
| rhs | The second value to compare |
|
friend |
6-way comparison is equivalent to comparing raw pointers.
| lhs | The first value to compare |
| rhs | The second value to compare |