Storm
A Modern Probabilistic Model Checker
|
Helper class that optionally holds a reference to an object of type T. More...
#include <OptionalRef.h>
Public Types | |
using | type = T |
Public Member Functions | |
OptionalRef () | |
Creates a non-initialized reference. | |
OptionalRef (NullRefType) | |
Creates a non-initialized reference. | |
template<class U , class = decltype(optionalref_detail::FUN<T>(std::declval<U>()), std::enable_if_t<!std::is_same_v<OptionalRef, std::remove_cv_t<std::remove_reference_t<U>>>>())> | |
constexpr | OptionalRef (U &&u) noexcept(noexcept(optionalref_detail::FUN< T >(std::forward< U >(u)))) |
Creates a reference to the provided object. | |
OptionalRef (OptionalRef< T > const &other)=default | |
Creates a copy of the given OptionalRef. | |
OptionalRef (OptionalRef< T > &&other)=default | |
Move constructs this OptionalRef from another one. | |
OptionalRef & | operator= (OptionalRef const &other)=delete |
Deleted assignment operator (see class description) | |
operator bool () const | |
Yields true iff this contains a reference. | |
bool | has_value () const |
Yields true iff this contains a reference. | |
T & | operator* () |
Accesses the contained reference (if any) | |
T const & | operator* () const |
Accesses the contained reference (if any) | |
T & | value () |
Accesses the contained reference (if any) | |
T const & | value () const |
Accesses the contained reference (if any) | |
T & | value_or (T &defaultValue) |
Returns the contained reference (if any). | |
T const & | value_or (T const &defaultValue) const |
Returns the contained reference (if any). | |
T * | operator-> () |
Yields a pointer to the referenced object (if any) | |
T const * | operator-> () const |
Yields a pointer to the referenced object (if any) | |
void | reset () |
Unsets the reference. | |
void | reset (NullRefType const &) |
Unsets the reference. | |
void | reset (T &t) |
Rebinds the reference. | |
Helper class that optionally holds a reference to an object of type T.
This mimics the interface of std::optional, except that an OptionalRef never takes ownership of an object.
foo(storm::OptionalRef<T const> bar = storm::NullRef)
instead of foo(T const& bar)
reset
method can be used.T | The type of the referenced object |
Definition at line 48 of file OptionalRef.h.
using storm::OptionalRef< T >::type = T |
Definition at line 52 of file OptionalRef.h.
|
inline |
Creates a non-initialized reference.
Definition at line 57 of file OptionalRef.h.
|
inline |
Creates a non-initialized reference.
Definition at line 62 of file OptionalRef.h.
|
inlineconstexprnoexcept |
Creates a reference to the provided object.
obj | the object this will be a reference to |
OptionalRef(foo)
(even if foo is of type e.g. T&) Definition at line 72 of file OptionalRef.h.
|
default |
Creates a copy of the given OptionalRef.
this
and other
will both reference the same object
|
default |
Move constructs this OptionalRef from another one.
|
inline |
Yields true iff this contains a reference.
Definition at line 100 of file OptionalRef.h.
|
inline |
Yields true iff this contains a reference.
Definition at line 93 of file OptionalRef.h.
|
inline |
Accesses the contained reference (if any)
Definition at line 108 of file OptionalRef.h.
|
inline |
Accesses the contained reference (if any)
Definition at line 117 of file OptionalRef.h.
|
inline |
Yields a pointer to the referenced object (if any)
Definition at line 158 of file OptionalRef.h.
|
inline |
Yields a pointer to the referenced object (if any)
Definition at line 167 of file OptionalRef.h.
|
delete |
Deleted assignment operator (see class description)
|
inline |
Unsets the reference.
has_value()
yields false after calling this.
Definition at line 175 of file OptionalRef.h.
|
inline |
Unsets the reference.
has_value()
yields false after calling this.
Definition at line 182 of file OptionalRef.h.
|
inline |
Rebinds the reference.
‘has_value()’ yields true after calling this.
Definition at line 189 of file OptionalRef.h.
|
inline |
Accesses the contained reference (if any)
Definition at line 126 of file OptionalRef.h.
|
inline |
Accesses the contained reference (if any)
Definition at line 135 of file OptionalRef.h.
|
inline |
Returns the contained reference (if any).
Otherwise, the provided default value is returned.
Definition at line 143 of file OptionalRef.h.
|
inline |
Returns the contained reference (if any).
Otherwise, the provided default value is returned.
Definition at line 150 of file OptionalRef.h.