Option.or

Return some value from this reference, or a default value by calling a callable argument. (function pointer, delegate, etc.)

The delegate can return a nullable type, but if the type is null an assertion error will be triggered, supposing the program is running in debug mode. The delegate may also return a Some type.

  1. Some!T or(DG dg)
  2. const(Some!T) or(DG dg)
    struct Option(T)
    const(Some!T)
    or
    const
    (
    DG
    )
    (
    DG dg
    )
    if (
    isCallable!DG &&
    (ParameterTypeTuple!DG).length == 0
    &&
    is(Unqual!(ReturnType!DG) : Unqual!T)
    )
    if (
    is(T == class) ||
    isPointer!T
    )
  3. immutable(Some!T) or(DG dg)

Parameters

dg
Type: DG

Some delegate returning a value.

Return Value

Type: const(Some!T)

This value, if the delegate's value if it is null.

Meta