Template Class not_null
Defined in File not_null.hpp
Class Documentation
A pointer enforced to never be equivalent to
nullptr.Public Functions
Lvalue constructor.
Disabled if type
Tisstd::nullptr_t.- Parameters
p – A non-null pointer.
- Throws
std::invalid_argument – if
pis equivalent tonullptrand the error mode is ErrorMode::DIE.
Rvalue constructor.
Disabled if type
Uis not implicitly convertible to typeT.- Parameters
p – Reference to a non-null pointer.
- Throws
std::invalid_argument – if
preferencesnullptrand the error mode is ErrorMode::DIE.
Custom copy constructor defined to use get() .
Disabled if type
Uofotheris not implicitly convertible to typeT.- Parameters
other – Object to copy.
Default copy constructor.
- Parameters
other – Object to copy.
Default move constructor.
- Parameters
other – Object to move.
Default copy assignment operator.
- Parameters
other – Object to copy.
- Returns
Reference to the newly copied object.
Default move assignment operator.
- Parameters
other – Object to move.
- Returns
Reference to the newly moved object.
Check and return the underlying pointer.
- Throws
std::runtime_error – if underlying pointer is equivalent to
nullptrand the error mode is ErrorMode::DIE.- Returns
The underlying pointer if it is still non-null. Returns a const reference if type
Tis not copy-constructible.
Define access operator to use get() .
- Returns
Underlying pointer after null check.
Define member dereference operator to use get() .
- Returns
Underlying pointer after null check.
Define dereference operator to use get() .
- Returns
Dereferenced pointer after null check.
Deleted.
Deleted to prevent
nullptrconstruction.
Deleted to prevent
nullptrassignment.
Deleted to prevent invalidation.
Deleted to prevent invalidation.
Deleted to prevent invalidation.
Deleted to prevent invalidation.
Deleted to prevent invalidation.
Deleted to prevent invalidation.
Friends
Declare friend overload for
std::dynamic_pointer_castfor ease of use withnot_null.