T using the same fallback semantics as as!T.T opCast(T)() if (is(T == string) || is(T == bool) || is(T == int) || is(T == long) || is(T == double) || is(T == float) || is(
T == const(string[])) || is(T == ArgValue)) const @safe pure nothrow @nogcExplicitly casts this ArgValue to the requested type using cast(T).
This provides D-idiomatic conversion syntax on top of the existing as!T helper. Supported target types are the same as for as!T:
string → string value or null if not a stringbool → boolean value or false if not a boolint → integer value or 0 if not an intlong → long value or 0L if not an integerdouble → double value or 0.0 if not a doublefloat → float value or 0.0f if not a doubleconst(string[]) → list value or null if not a listT | Target type to cast to. |
T using the same fallback semantics as as!T.string file = cast(string) args["<file>"];
bool verbose = cast(bool) args["--verbose"];
int count = cast(int) args["--count"];
auto files = cast(const(string[])) args["<file>"];