|
Common System 0.2.0
Common interfaces and patterns for system integration
|
Optional type similar to std::optional with Rust-like API. More...
#include <core.h>

Public Types | |
| using | value_type = T |
| Type alias for the contained value type (for concept compatibility) | |
Public Member Functions | |
| Optional () | |
| Optional (const T &value) | |
| Optional (T &&value) | |
| Optional (std::nullopt_t) | |
| bool | has_value () const |
| bool | is_some () const |
| bool | is_none () const |
| const T & | value () const |
| T & | value () |
| const T & | unwrap () const |
| Get value from optional (throws if None) | |
| T | unwrap_or (T default_value) const |
| template<typename F > | |
| auto | map (F &&func) const -> Optional< decltype(func(std::declval< T >()))> |
| Optional () | |
| Optional (const T &value) | |
| Optional (T &&value) | |
| Optional (std::nullopt_t) | |
| bool | has_value () const |
| bool | is_some () const |
| bool | is_none () const |
| const T & | value () const |
| T & | value () |
| const T & | unwrap () const |
| T | unwrap_or (T default_value) const |
| template<typename F > | |
| auto | map (F &&func) const -> Optional< decltype(func(std::declval< T >()))> |
Private Attributes | |
| std::optional< T > | value_ |
Optional type similar to std::optional with Rust-like API.
| T | The type of the contained value |
|
export |
|
inline |
Definition at line 477 of file core.h.
Referenced by kcenon::common::Optional< T >::map().

|
inline |
|
inline |
|
inline |
|
inlineexport |
|
inlineexport |
|
inlineexport |
|
inlineexport |
|
inline |
Definition at line 482 of file core.h.
References kcenon::common::Optional< T >::value_.
Referenced by kcenon::common::Optional< T >::map(), and kcenon::common::Optional< T >::unwrap().

|
inlineexport |
|
inline |
|
inlineexport |
|
inline |
|
inlineexport |
|
inline |
Definition at line 521 of file core.h.
References kcenon::common::Optional< T >::has_value(), kcenon::common::Optional< T >::Optional(), and kcenon::common::Optional< T >::value_.

|
inlineexport |
Definition at line 386 of file core.cppm.
References kcenon::common::Optional< T >::has_value(), kcenon::common::Optional< T >::Optional(), and kcenon::common::Optional< T >::value_.

|
inline |
Get value from optional (throws if None)
| std::runtime_error | if optional is None with detailed location info |
Definition at line 508 of file core.h.
References kcenon::common::Optional< T >::has_value(), and kcenon::common::Optional< T >::value_.

|
inlineexport |
Definition at line 373 of file core.cppm.
References kcenon::common::Optional< T >::has_value(), and kcenon::common::Optional< T >::value_.

|
inline |
Definition at line 516 of file core.h.
References kcenon::common::Optional< T >::value_.
|
inlineexport |
Definition at line 381 of file core.cppm.
References kcenon::common::Optional< T >::value_.
|
inline |
|
inlineexport |
|
inline |
|
inlineexport |
|
exportprivate |
Definition at line 474 of file core.h.
Referenced by kcenon::common::Optional< T >::has_value(), kcenon::common::Optional< T >::is_none(), kcenon::common::Optional< T >::is_some(), kcenon::common::Optional< T >::map(), kcenon::common::Optional< T >::unwrap(), kcenon::common::Optional< T >::unwrap_or(), kcenon::common::Optional< T >::value(), and kcenon::common::Optional< T >::value().