SpECTRE
v2024.09.29
|
Require a pointer to not be a nullptr
More...
#include <Gsl.hpp>
Public Member Functions | |
template<typename U , Requires< std::is_convertible< U, T >::value > = nullptr> | |
constexpr | not_null (U &&u) |
template<typename U , Requires< std::is_convertible< U, T >::value > = nullptr> | |
constexpr | not_null (const not_null< U > &other) |
not_null (const not_null &other)=default | |
not_null & | operator= (const not_null &other)=default |
constexpr T | get () const |
constexpr | operator T () const |
constexpr T | operator-> () const |
constexpr decltype(auto) | operator* () const |
not_null (std::nullptr_t)=delete | |
not_null & | operator= (std::nullptr_t)=delete |
not_null & | operator++ ()=delete |
not_null & | operator-- ()=delete |
not_null | operator++ (int)=delete |
not_null | operator-- (int)=delete |
not_null & | operator+= (std::ptrdiff_t)=delete |
not_null & | operator-= (std::ptrdiff_t)=delete |
void | operator[] (std::ptrdiff_t) const =delete |
Require a pointer to not be a nullptr
Restricts a pointer or smart pointer to only hold non-null values.
Has zero size overhead over T
.
If T
is a pointer (i.e. T == U*
) then
U*
nullptr_t
U*
failsU*