mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-15 16:36:03 +08:00
1.7 KiB
1.7 KiB
| title |
|---|
| not_null |
{{< callout type="info">}}
Header: not_null.h
Since: 20.43.0
{{< /callout >}}
A container for pointers that are not allowed to be null.
template <typename T>
class not_null;
Specialised for pointers and etl::unique_ptr.
template <typename T>
class not_null<T*>
template <typename T, typename TDeleter>
class not_null<etl::unique_ptr<T, TDeleter>>
Public types
T value_type;
T* pointer;
const T* const_pointer;
T& reference;
const T& const_reference;
pointer underlying_type;
Member functions
explicit not_null(underlying_type ptr)
Constructs a not_null from an underlying type.
Description
Asserts etl::not_null_contains_null if the pointer is null.
not_null(const etl::not_null<T*>& other)
Description
Copy constructor from a not_null.
not_null& operator =(const etl::not_null<T*>& rhs)
Description
Assignment from a not_null.
not_null& operator =(underlying_type rhs)
Description
Assignment from a pointer.
Asserts etl::not_null_contains_null if the pointer is null.
pointer get() const
Description
Gets the underlying pointer.
operator pointer() const
Description
Implicit conversion to pointer.
reference operator*() const
Description
Dereference operator.
pointer operator->() const
Description
Arrow operator.
underlying_type& underlying()
Description
Gets a reference to the underlying type.
const underlying_type& underlying() const
Description
Gets a const reference to the underlying type.