|
| Optional () |
| Default construct (no value) More...
|
|
bool | hasValue () const |
| Determines whether or not this Optional<T> is empty. More...
|
|
const value_type & | get () const |
| Retrieves the value stored in this Optional<T> More...
|
|
| Optional (const value_type &value) |
| Creates a non empty optional with the given value (copy) More...
|
|
Optional & | operator= (const value_type &value) |
| Assign a value to this optional. More...
|
|
| Optional (const Optional &o) |
| Copy constructor. More...
|
|
Optional & | operator= (const Optional &rhs) |
| Copy assignment operator. More...
|
|
| operator const value_type & () const |
| Automatic conversion operator. More...
|
|
| Optional (Optional &&rhs) |
| Move constructor. More...
|
|
Optional & | operator= (Optional &&rhs) noexcept |
| Move assignment operator. More...
|
|
| Optional (None _) |
| Instantiate an optional via an instance of None. More...
|
|
Optional & | operator= (None _) |
| Assign from None. More...
|
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, scl::tools::meta ::decay_t<T>>() && ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, None>() && ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, Optional>() >> |
| Optional (const U &value) |
| Implicit conversion copy constructor. More...
|
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, scl::tools::meta ::decay_t<T>>() && ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, None>() && ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, Optional>() >> |
Optional & | operator= (const U &value) |
| Implicit conversion copy assignment. More...
|
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, scl::tools::meta ::decay_t<T>>() && ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, None>() && ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, Optional>() >> |
| Optional (U &&value) |
| Implicit conversion move constructor. More...
|
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, scl::tools::meta ::decay_t<T>>() && ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, None>() && ! scl::tools::meta ::is_same< scl::tools::meta ::decay_t<U>, Optional>() >> |
Optional & | operator= (U &&value) |
| Implicit conversion move assignment. More...
|
|
const value_type & | value () const |
| A semantic alias for Optional<T>::get. More...
|
|
const value_type *const | ptr () const |
| Get an immutable pointer to the contained value. More...
|
|
| operator bool () const |
| Automatic bool conversion. More...
|
|
const value_type & | operator* () const |
| Access to the value. More...
|
|
const value_type *const | operator-> () const |
| Get an immutable pointer to the stored value. More...
|
|
const value_type & | orElse (const value_type &defaultValue) const |
| Retrieves the value if there's one or return the default value provided. More...
|
|
template<class F > |
const Optional & | doIfPresent (F &&f) const |
| Calls a function if the value is present. More...
|
|
template<class F > |
const Optional & | ifSome (F &&f) const |
| Alias for scl::utils::Optional::doIfPresent. More...
|
|
template<class F > |
const Optional & | doIfEmpty (F &&f) const |
| Calls a function if there is no value. More...
|
|
template<class F > |
const Optional & | ifNone (F &&f) const |
| Alias for scl::utils::Optional::doIfEmpty. More...
|
|
template<class E > |
const value_type & | orThrow (const E &e) const |
| Tries to retrieve the value, throws the given exception if there's none. More...
|
|
template<class U , class F > |
Optional< U > | map (F &&mapper) const |
| Maps this Optional<T> to an Optional<U> via the provided mapper function (T -> U) More...
|
|
template<class U , class F > |
Optional< U > | mapTo (F &&mapper) const |
| Alias for Optional::map. More...
|
|
template<class F > |
Optional< T > | filter (F predicate) const |
| Filters the value according to the given predicate. More...
|
|
template<class U , class F > |
Optional< U > | flatMap (F &&mapper) const |
| Flat maps this optional to an optional of another type. More...
|
|
template<class U , class F > |
Optional< U > | flatMapTo (F &&mapper) const |
| Alias for Optional::flatMap. More...
|
|
bool | operator== (None) const |
|
bool | operator< (None) const |
|
bool | operator<= (None) const |
|
bool | operator> (None) const |
|
bool | operator>= (None) const |
|
bool | operator!= (None) const |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator== (const U &t) const |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator!= (const U &t) const |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator< (const U &t) const |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator<= (const U &t) const |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator> (const U &t) const |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator>= (const U &t) const |
|
template<class U > |
bool | operator== (const Optional< U > &o) const |
|
template<class U > |
bool | operator!= (const Optional< U > &o) const |
|
template<class U > |
bool | operator< (const Optional< U > &o) const |
|
template<class U > |
bool | operator<= (const Optional< U > &o) const |
|
template<class U > |
bool | operator> (const Optional< U > &o) const |
|
template<class U > |
bool | operator>= (const Optional< U > &o) const |
|
|
bool | operator== (None, const Optional &o) |
|
bool | operator< (None, const Optional &) |
|
bool | operator<= (None, const Optional &) |
|
bool | operator> (None, const Optional &) |
|
bool | operator>= (None, const Optional &o) |
|
bool | operator!= (None, const Optional &o) |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator== (const U &t, const Optional &o) |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator!= (const U &t, const Optional &o) |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator< (const U &t, const Optional &o) |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator<= (const U &t, const Optional &o) |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator> (const U &t, const Optional &o) |
|
template<class U , class = scl::tools::meta ::enable_if_t< ! scl::tools::meta ::is_same<U, None>() && ! scl::tools::meta ::is_same<U, Optional>() && ! scl::tools::meta ::is_instance<scl::utils::Optional, U>() >> |
bool | operator>= (const U &t, const Optional &o) |
|
template<class T>
class scl::utils::Optional< T >
A class that allows the use of optional types (might be there)
- Template Parameters
-
T | being the value type that is optional |
- Warning
- Optional defines move and/or copy semantics only if the underlying type does as well
Definition at line 65 of file Optional.h.