A C++ template library for embedded applications
MIT licensed
Designed and
maintained by
John Wellbelove

not_null

20.43.0
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.
Asserts etl::not_null_contains_null if the pointer is null.

not_null(const etl::not_null<T*>& other)
Copy constructor from a not_null.
____________________________________________________________________________________________________
not_null& operator =(const etl::not_null<T*>& rhs)
Assignment from a not_null.

not_null& operator =(underlying_type rhs)
Assignment from a pointer.
Asserts etl::not_null_contains_null if the pointer is null.
____________________________________________________________________________________________________
pointer get() const
Gets the underlying pointer.
____________________________________________________________________________________________________
operator pointer() const
Implicit conversion to pointer.
____________________________________________________________________________________________________
reference operator*() const
Dereference operator.
____________________________________________________________________________________________________
pointer operator->() const
Arrow operator.
____________________________________________________________________________________________________
underlying_type& underlying()
Gets a reference to the underlying type.

const underlying_type& underlying() const
Gets a const reference to the underlying type.
____________________________________________________________________________________________________
not_null.h