OptionalTarget

Returns the target type of a optional.

Members

Aliases

OptionalTarget
alias OptionalTarget = TemplateArgsOf!T[0]
Undocumented in source.

Examples

import optional: Optional;

class C {}
struct S {}

import std.meta: AliasSeq;
foreach (T; AliasSeq!(int, int*, S, C, int[], S[], C[])) {
    alias CT = const T;
    alias IT = immutable T;
    alias ST = shared T;

    static assert(is(OptionalTarget!(Optional!T) == T));
    static assert(is(OptionalTarget!(Optional!CT) == CT));
    static assert(is(OptionalTarget!(Optional!IT) == IT));
    static assert(is(OptionalTarget!(Optional!ST) == ST));
}

Meta