Like ptr, but never null, which makes decompression a single add.
Declared in <cptr/ptr.hpp>
template<
class T,
class Cage = default_cage>
class nonnull_ptr;
It converts implicitly to ptr and strict_ptr (to the same type, a base or void), and to a nonnull_ptr to a base. destroy() accepts it.
| Name | Description |
|---|---|
cage_type | The cage the pointer is compressed against. |
element_type | The type pointed to. |
| Name | Description |
|---|---|
nonnull_ptr [constructor] | Constructors |
bits | The compressed representation, as for basic_ptr::bits(); never 0. |
get | The raw pointer: a single add, with no null check. |
operator* | The object pointed to. |
operator-> | Member access. |
operator T* | Converts implicitly to the raw pointer. |
operator basic_ptr<U, Cage, S> | Converts implicitly to a nullable ptr or strict_ptr to U, where T* converts implicitly to U*. The pointer is already in the cage, so strict_ptr accepts it implicitly too. |
| Name | Description |
|---|---|
from_bits | The pointer whose bits() are bits, which must not be 0 (that is null in a ptr) and must come from a pointer into the same cage; see basic_ptr::from_bits. |
| Name | Description |
|---|---|
cptr::operator<=> | Orders like the addresses. |
cptr::operator== | Same address. |
| Name | Description |
|---|---|
destroy | destroy() for a nonnull_ptr. |