|
libhatchet
|
#include <hxptr.hpp>
Public Types | |
| using | element_t = T |
Public Member Functions | |
| constexpr | hxptr (T *ptr_=0, deleter_t_ deleter_=deleter_t_()) noexcept |
| constexpr | hxptr (hxnil_t) noexcept |
| constexpr | hxptr (hxptr &&x_) noexcept |
| constexpr | ~hxptr (void) noexcept |
| constexpr hxptr & | operator= (hxptr &&x_) noexcept |
| constexpr T & | operator* (void) const |
| constexpr T * | operator-> (void) const |
| constexpr | operator bool (void) const |
| constexpr bool | operator== (const hxptr &x_) const |
| constexpr bool | operator== (hxnil_t) const |
| template<typename self_t_, typename callable_t_> | |
| constexpr auto | and_then (this self_t_ &&self_, callable_t_ &&callable_) -> hxremove_cvref_t< decltype(hxforward< callable_t_ >(callable_)(hxdeclval< T & >()))> |
| constexpr const deleter_t_ & | deleter (void) const |
| constexpr deleter_t_ & | deleter (void) |
| template<hxsystem_allocator_t allocator_ = hxsystem_allocator_current, hxalignment_t alignment_ = hxalignment, typename... args_t_> | |
| T & | emplace (args_t_ &&... args_) noexcept |
| constexpr bool | equal (const hxptr &x_) const |
| constexpr T * | get (void) const |
| hxhash_t | hash (void) const |
| constexpr bool | has_value (void) const |
| template<typename self_t_, typename callable_t_> requires (hxis_rvalue_reference<self_t_&&>() && !hxis_const<hxremove_reference_t<self_t_>>()) | |
| constexpr hxptr | or_else (this self_t_ &&self_, callable_t_ &&callable_) |
| constexpr T * | release (void) |
| constexpr void | reset (T *ptr_=0) noexcept |
| constexpr void | swap (hxptr &x_) noexcept |
| constexpr T & | value (void) const |
| template<typename self_t_, typename... args_t_> | |
| constexpr hxremove_cv_t< T > | value_or (this self_t_ &&self_, args_t_ &&... args_) |
hxptr<T, deleter_t> - A unique owning pointer.
Owns a single dynamically allocated object of type T and invokes deleter_t on destruction or reset. Only one hxptr may own a given object at a time. Move construction and move assignment transfer ownership. Copy construction and copy assignment are deleted.
| using hxptr< T, deleter_t_ >::element_t = T |
element_t - Publishes the pointed-to type.
|
explicitconstexprnoexcept |
|
constexprnoexcept |
Move constructor.
Transfers ownership from x to this. x is left null.
|
constexprnoexcept |
Destroys the owned object using deleter_t if non-null.
|
constexpr |
Returns the result of calling callable with the owned object if non-null, otherwise returns hxnil.
Use and_then to return hxptr, hxref or hxexpected.
|
constexpr |
|
constexpr |
Returns a const reference to the stored deleter.
|
noexcept |
Replaces the owned object with one constructed from args and returns a reference to it.
|
constexpr |
Returns true if this and x point to the same object.
|
inlineconstexpr |
Returns the owned pointer without releasing ownership.
|
inlineconstexpr |
Returns true if the owned pointer is non-null.
| hxhash_t hxptr< T, deleter_t_ >::hash | ( | void | ) | const |
Returns the hash of the owned value if non-null, otherwise 31u.
|
explicitconstexpr |
Returns true if the owned pointer is non-null.
|
constexpr |
Returns a reference to the owned object. The pointer must not be null.
|
constexpr |
Returns the owned pointer. The pointer must not be null.
|
constexprnoexcept |
Move assignment.
Destroys the currently owned object, then transfers ownership from x. x is left null. Self-assignment is not supported.
|
inlineconstexpr |
Returns true if this and x point to the same object.
|
constexpr |
Returns true if the owned pointer is null.
|
constexpr |
|
constexpr |
Releases ownership and returns the previously owned pointer without invoking the deleter.
The caller takes responsibility for freeing it.
|
constexprnoexcept |
Destroys the currently owned object using deleter_t if non-null, then takes ownership of ptr.
|
constexpr |
Returns a reference to the owned object without releasing ownership.
|
constexpr |
Returns the owned value if non-null, otherwise returns a T constructed from args.