Calls a function if the optional is empty.

Synopsis

Declared in <beman/optional/optional.hpp>

template<class F>
constexpr
optional<T&>
or_else(F&& f) const;

Description

The return type is the same as the return type of f, which must return an optional type.

Return Value

  • optional

  • optional<T&>

Template Parameters

Name Description

F

The type of the invocable

Parameters

Name Description

f

The invocable to apply to the contained value

Created with MrDocs