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&>

Created with MrDocs