Skip to content

Class endstone::Nullable

template <class T>

ClassList > endstone > Nullable

A wrapper around a std::shared_ptr that may be null. More...

  • #include <endstone/util/pointers.h>

Public Types

Type Name
typedef T element_type
typedef std::shared_ptr< T > pointer_type

Public Functions

Type Name
constexpr Nullable () noexcept
constexpr Nullable (std::nullptr_t) noexcept
Nullable (std::shared_ptr< T > ptr)
Nullable (const NotNull< T > & other)
Nullable (std::shared_ptr< U > ptr)
Covariant conversion from a shared_ptr of a convertible (e.g.
Nullable (const Nullable< U > & other)
Covariant conversion from a Nullable of a convertible (e.g.
Nullable (const NotNull< U > & other)
Covariant conversion from a NotNull of a convertible (e.g.
const pointer_type & get () noexcept const
operator bool () noexcept const
T & operator* () noexcept const
T * operator-> () noexcept const
bool operator== (std::nullptr_t) noexcept const
T & value () const
Returns a reference to the contained value, throwing std::runtime_error if this is null.
pointer_type value_or (pointer_type default_value) const
Returns the contained pointer if present, otherwise the supplied default.

Detailed Description

Convertible from a NotNull, and contextually convertible to bool to test for a value.

Public Types Documentation

typedef element_type

using endstone::Nullable< T >::element_type =  T;

typedef pointer_type

using endstone::Nullable< T >::pointer_type =  std::shared_ptr<T>;

Public Functions Documentation

function Nullable [1/7]

constexpr endstone::Nullable::Nullable () noexcept

function Nullable [2/7]

inline constexpr endstone::Nullable::Nullable (
    std::nullptr_t
) noexcept

function Nullable [3/7]

inline endstone::Nullable::Nullable (
    std::shared_ptr< T > ptr
) 

function Nullable [4/7]

inline endstone::Nullable::Nullable (
    const  NotNull < T > & other
) 

function Nullable [5/7]

Covariant conversion from a shared_ptr of a convertible (e.g.

template<class  U>
inline endstone::Nullable::Nullable (
    std::shared_ptr< U > ptr
) 

derived) type.


function Nullable [6/7]

Covariant conversion from a Nullable of a convertible (e.g.

template<class  U>
inline endstone::Nullable::Nullable (
    const  Nullable < U > & other
) 

derived) type.


function Nullable [7/7]

Covariant conversion from a NotNull of a convertible (e.g.

template<class  U>
inline endstone::Nullable::Nullable (
    const  NotNull < U > & other
) 

derived) type.


function get

inline const pointer_type & endstone::Nullable::get () noexcept const

function operator bool

inline explicit endstone::Nullable::operator bool () noexcept const

function operator*

inline T & endstone::Nullable::operator* () noexcept const

function operator->

inline T * endstone::Nullable::operator-> () noexcept const

function operator==

inline bool endstone::Nullable::operator== (
    std::nullptr_t
) noexcept const

function value

Returns a reference to the contained value, throwing std::runtime_error if this is null.

inline T & endstone::Nullable::value () const


function value_or

Returns the contained pointer if present, otherwise the supplied default.

inline pointer_type endstone::Nullable::value_or (
    pointer_type default_value
) const



The documentation for this class was generated from the following file include/endstone/util/pointers.h