|
MT Core (C++)
Core library for replacing C++ standard in project usage
|
Represents a pointer that may or may not be null. More...
#include <optional.hpp>


Public Member Functions | |
| Optional () | |
| Creates an empty Optional. | |
| Optional (T *value) | |
| Creates an Optional from a value. | |
| bool | operator== (const Optional &other) const noexcept |
| Checks if value is equal to another Optional. | |
| bool | has_value () const noexcept |
| T | value_or (const T &def) const noexcept |
| Returns the value in the optional, or a default value if the optional is empty. | |
| T & | value () noexcept |
| const T & | value () const noexcept |
| bool | copy_if_present (T *&out) const noexcept |
Copies a value to a reference output destination if a value is present Designed to be used by simple iterators as part of a while loop on a next() method Example: | |
| bool | copy_if_present (std::remove_const_t< T > &out) const noexcept |
Copies a value to a reference output destination if a value is present Designed to be used by simple iterators as part of a while loop on a next() method Example: | |
| bool | move_if_present (std::remove_const_t< T > *&out) noexcept |
| Moves a value to a reference output destination if a value is present. | |
| bool | move_if_present (std::remove_const_t< T > &out) noexcept |
| Moves a value to a reference output destination if a value is present. | |
| const T & | operator* () const |
| Dereferences the internal value. | |
| const T * | operator-> () const |
| Dereferences the internal value. | |
| T & | operator* () |
| Dereferences the internal value. | |
| T * | operator-> () |
| Dereferences the internal value. | |
| Optional () | |
| Creates an empty Optional. | |
| Optional (const T &value) | |
| Creates an Optional from a value. | |
| Optional (T &&value) | |
| Creates an Optional from a value. | |
| bool | operator== (const Optional &other) const noexcept |
| Checks if value is equal to another Optional. | |
| bool | operator== (const T &other) const noexcept |
| Checks if value is equal to a non-Optional value. | |
| T | value_or (const T &def) const noexcept |
| Returns the value in the optional, or a default value if the optional is empty. | |
| bool | has_value () const noexcept |
| bool | empty () const noexcept |
| T & | value () noexcept |
| const T & | value () const noexcept |
| bool | copy_if_present (std::remove_const_t< T > &out) const noexcept |
Copies a value to a reference output destination if a value is present Designed to be used by simple iterators as part of a while loop on a next() method Example: | |
| bool | move_if_present (T &out) noexcept |
| Moves a value to a reference output destination if a value is present. | |
| const T & | operator* () const |
| Dereferences the internal value. | |
| T & | operator* () |
| Dereferences the internal value. | |
| const T * | operator-> () const |
| Dereferences the internal value. | |
| T * | operator-> () |
| Dereferences the internal value. | |
Represents a pointer that may or may not be null.
Allows pulling out the underlying value pointed to as well as the pointer itself
Definition at line 48 of file optional.hpp.
|
inline |
Creates an empty Optional.
Definition at line 56 of file optional.hpp.

|
inline |
Creates an Optional from a value.
Definition at line 61 of file optional.hpp.

|
inline |
Creates an empty Optional.
Definition at line 243 of file optional.hpp.
|
inline |
|
inline |
|
inlinenodiscardnoexcept |
Copies a value to a reference output destination if a value is present Designed to be used by simple iterators as part of a while loop on a next() method Example:
| out | Where to put the destination |
Definition at line 143 of file optional.hpp.

|
inlinenodiscardnoexcept |
Copies a value to a reference output destination if a value is present Designed to be used by simple iterators as part of a while loop on a next() method Example:
| out | Where to put the destination |
Definition at line 327 of file optional.hpp.
|
inlinenodiscardnoexcept |
Copies a value to a reference output destination if a value is present Designed to be used by simple iterators as part of a while loop on a next() method Example:
| out | Where to put the destination |
Definition at line 120 of file optional.hpp.

|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Definition at line 81 of file optional.hpp.

|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Moves a value to a reference output destination if a value is present.
Will mark the Optional as empty Designed to be used by simple iterators as part of a while loop on a next() method Example:
| out | Where to put the destination |
Definition at line 193 of file optional.hpp.

|
inlinenodiscardnoexcept |
Moves a value to a reference output destination if a value is present.
Will mark the Optional as empty Designed to be used by simple iterators as part of a while loop on a next() method Example:
| out | Where to put the destination |
Definition at line 167 of file optional.hpp.

|
inlinenodiscardnoexcept |
Moves a value to a reference output destination if a value is present.
Will mark the Optional as empty Designed to be used by simple iterators as part of a while loop on a next() method Example:
| out | Where to put the destination |
Definition at line 352 of file optional.hpp.
|
inline |
Dereferences the internal value.
Definition at line 220 of file optional.hpp.

|
inline |
|
inline |
Dereferences the internal value.
Definition at line 204 of file optional.hpp.

|
inline |
|
inline |
Dereferences the internal value.
Definition at line 228 of file optional.hpp.

|
inline |
|
inline |
Dereferences the internal value.
Definition at line 212 of file optional.hpp.

|
inline |
|
inlinenoexcept |
Checks if value is equal to another Optional.
Definition at line 66 of file optional.hpp.

|
inlinenoexcept |
Checks if value is equal to another Optional.
Definition at line 258 of file optional.hpp.
|
inlinenoexcept |
Checks if value is equal to a non-Optional value.
Definition at line 273 of file optional.hpp.
|
inlinenodiscardnoexcept |
|
inlinenodiscardnoexcept |
Definition at line 306 of file optional.hpp.
|
inlinenodiscardnoexcept |
Definition at line 94 of file optional.hpp.


|
inlinenodiscardnoexcept |
Definition at line 301 of file optional.hpp.
|
inlinenodiscardnoexcept |
Returns the value in the optional, or a default value if the optional is empty.
| def | Default value |
Definition at line 87 of file optional.hpp.

|
inlinenodiscardnoexcept |
Returns the value in the optional, or a default value if the optional is empty.
| def | Default value |
Definition at line 284 of file optional.hpp.