castFrom.to

Explicit cast function -- both from and to types must be specified by the user and are statically ensured to be correct. This extra security can help prevent refactoring errors.

Usage:

int i;
float f = castFrom!(int).to!(float)(i);
template castFrom(From)
To
to
(
To
T
)
()

Parameters

From

type to cast from

To

type to cast to

T

type of value being cast (statically checked to be == From)

value T

value to be cast to type To

Return Value

Type: To

input parameter cast to type To

Meta