Template Struct ValueOr

Inheritance Relationships

Derived Types

Struct Documentation

template<typename Derived, typename ValueType>
struct ValueOr

Subclassed by iox::cxx::internal::FunctionalInterfaceImpl< Derived, ValueType, ErrorType >, iox::cxx::internal::FunctionalInterfaceImpl< Derived, ValueType, void >

Public Functions

template<typename U>
ValueType value_or(U &&alternative) const & noexcept

When the object contains a value a copy will be returned otherwise alternative is perfectly forwarded to the ValueType constructor.

Parameters:

alternative[in] the return value which will be used when the object does not contain a value

Returns:

A copy of the contained value when present otherwise return new ValueType with alternative as constructor argument

template<typename U>
ValueType value_or(U &&alternative) && noexcept

When the object contains a value the value will be returned via move otherwise alternative is perfectly forwarded to the ValueType constructor.

Parameters:

alternative[in] the return value which will be used when the object does not contain a value

Returns:

The contained value is returned via move when present otherwise return new ValueType with alternative as constructor argument